diff --git a/.github/workflows/app-manual-deploy.yaml b/.github/workflows/app-manual-deploy.yaml index 27cf22f..072654e 100644 --- a/.github/workflows/app-manual-deploy.yaml +++ b/.github/workflows/app-manual-deploy.yaml @@ -10,11 +10,19 @@ on: jobs: get_env_name: - name: Pre task + name: PreTask uses: ./.github/workflows/get-environment-from-branch.yaml + auto_format: + name: PreTask + uses: ./.github/workflows/format-at-astro.yaml + permissions: + actions: write + checks: write + contents: write + deploy: - needs: ["get_env_name"] + needs: ["get_env_name", "auto_format"] environment: name: ${{ needs.get_env_name.outputs.env_name }} url: ${{ steps.published.outputs.pageurl }} @@ -35,7 +43,10 @@ jobs: - name: Build shell: bash - run: node --version; npm install && npm run build + run: | + echo "Commit: $(git show --format='%H' --no-patch)" + echo "Node Version: $(node --version)" + npm install && npm run build working-directory: ./astro env: PUBLIC_CREATEPAGES_ENDPOINT: ${{ secrets.PUBLIC_CREATEPAGES_ENDPOINT }} @@ -72,7 +83,7 @@ jobs: await github.rest.repos.createCommitStatus({ owner: context.repo.owner, repo: context.repo.repo, - context: 'Cloudflare Pages', + context: 'App Build & Deploy', description: 'Deploy to Cloudflare Pages: Click Details to see build result', state: 'success', sha, diff --git a/.github/workflows/auto-pr-format-at-astro.yaml b/.github/workflows/format-at-astro.yaml similarity index 67% rename from .github/workflows/auto-pr-format-at-astro.yaml rename to .github/workflows/format-at-astro.yaml index fd94f63..8e9ff46 100644 --- a/.github/workflows/auto-pr-format-at-astro.yaml +++ b/.github/workflows/format-at-astro.yaml @@ -1,11 +1,7 @@ -name: Auto-format PR commit code at ./astro +name: Format code at ./astro on: - pull_request: - types: ["opened", "synchronize", "reopened"] - push: - branches: - - main + workflow_call: {} permissions: actions: write @@ -13,7 +9,8 @@ permissions: contents: write jobs: - auto-format: + auto_format: + name: Format code at ./astro runs-on: ubuntu-latest steps: ## PRのブランチをcheckout @@ -21,7 +18,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 2 - ref: ${{ github.head_ref }} + - name: Run Prettier at ./astro id: format shell: bash @@ -36,6 +33,10 @@ jobs: run: | git config user.name github-actions git config user.email github-actions@github.com - git add . - git commit -m "[Github Action] Auto PR Format" - git push + if (git diff --shortstat | grep '[0-9]'); then + git add . + git commit -m "[Github Action] Auto PR Format" + git push + else + echo "no difference found." + fi