Bump actions/setup-node from 6 to 7 (#73) #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # PR と main への push でビルドを通す。 | |
| # docker-publish はイメージを作るだけで、失敗しても PR の側には出ないため、 | |
| # 依存更新(Dependabot)や手直しの PR はここが通ってからマージする。 | |
| # | |
| # テストは無いので、通すのは next build まで —— 型エラーと依存の不整合はここで落ちる。 | |
| # 公開リポジトリなので標準ランナーの実行時間は無料枠の外。 | |
| name: ci | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| # 同じ ref への連続 push では古い実行を打ち切る | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| # Dockerfile のベース(node:24-alpine)と合わせる | |
| node-version: "24" | |
| cache: npm | |
| - run: npm ci | |
| # DB もクラウドの鍵も要らない(next build は静的解析とバンドルまで) | |
| - run: npm run build | |
| # Dependabot の PR のうち、破壊的でない更新(patch / minor)を自動でマージする。 | |
| # | |
| # needs が唯一のゲート —— ブランチ保護は掛けていない運用なので、 | |
| # 「CI が通ってからマージする」をジョブの依存関係で表している。 | |
| # major は自動で入れない(壊れ方が読めないので人が見る)。 | |
| auto-merge: | |
| needs: build | |
| if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| # マージ後にイメージのビルドを起こすために要る(下の理由を参照) | |
| actions: write | |
| steps: | |
| - name: 更新の種類を読む | |
| id: meta | |
| uses: dependabot/fetch-metadata@v2 | |
| - name: patch / minor ならマージする | |
| if: steps.meta.outputs.update-type != 'version-update:semver-major' | |
| run: gh pr merge --squash --delete-branch "$PR_URL" | |
| env: | |
| PR_URL: ${{ github.event.pull_request.html_url }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # GITHUB_TOKEN で作った push は workflow を起こさないので、このままだと | |
| # 依存が main に入ってもイメージが作り直されない。workflow_dispatch は | |
| # GITHUB_TOKEN でも発火する例外なので、明示的に起こす | |
| - name: イメージのビルドを起こす | |
| if: steps.meta.outputs.update-type != 'version-update:semver-major' | |
| run: gh workflow run docker-publish.yml --ref main | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |