name: main on: push: pull_request: permissions: contents: read issues: write pull-requests: write jobs: build: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v5 - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 with: node-version-file: ".tool-versions" cache: "npm" - name: Install run: npm ci - name: Build run: npm run build - name: Check dist freshness id: dist_freshness continue-on-error: true run: | git diff --exit-code --stat -- dist/index.js \ || (echo "##[error] found changed dist/index.js after build. please run 'npm run build' and commit the updated bundle" \ && exit 1) - name: Comment on stale dist bundle if: github.event_name == 'pull_request' && steps.dist_freshness.outcome == 'failure' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }} run: | marker='' diff_stat="$(git diff --stat -- dist/index.js)" body=$(cat <"))) | .id' \ | tail -n 1 )" if [ -n "$existing_id" ]; then gh api --method PATCH "repos/$GH_REPO/issues/comments/$existing_id" -f body="$body" >/dev/null else gh api --method POST "repos/$GH_REPO/issues/$PR_NUMBER/comments" -f body="$body" >/dev/null fi - name: Fail on stale dist bundle if: steps.dist_freshness.outcome == 'failure' run: | echo "##[error] found changed dist/index.js after build. please run 'npm run build' and commit the updated bundle" exit 1 - name: Test run: npm run test - name: Format run: npm run fmtcheck