[Test/do-not-merge] chronus-verify CI smoke test for #46585 #11
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
| name: Chronus Verify | |
| on: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "sdk/*/*/**" | |
| concurrency: | |
| group: chronus-verify-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| chronus-verify: | |
| name: Verify Chronus Change Descriptions | |
| if: github.event.pull_request.user.login != 'azure-sdk' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| issues: write | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 # needed so chronus can diff against base branch | |
| persist-credentials: false | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: lts/* | |
| cache: npm | |
| cache-dependency-path: .github/chronus/package-lock.json | |
| - name: Install pinned dependencies | |
| run: npm ci | |
| working-directory: .github/chronus | |
| - name: Run chronus verify | |
| id: verify | |
| run: .github/chronus/node_modules/.bin/chronus verify | |
| # Sticky comment is only post-able when GITHUB_TOKEN has write scope — | |
| # i.e. PRs from the main repo. Fork PRs see only the error annotation | |
| # below, which is fine because /chronus add doesn't work for forks anyway. | |
| - name: Post sticky one-click-fix PR comment on failure | |
| if: failure() && steps.verify.conclusion == 'failure' && github.event.pull_request.head.repo.full_name == github.repository | |
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
| with: | |
| script: | | |
| const HEADER = '<!-- chronus-verify-sticky -->'; | |
| const body = [ | |
| HEADER, | |
| '### 📝 Missing changelog entry', | |
| '', | |
| 'This PR touches package source under `sdk/*/*/**` but no Chronus', | |
| 'change description was found. CI requires every user-affecting', | |
| 'change to have one.', | |
| '', | |
| '#### ⚡ One-click fix', | |
| '', | |
| '**Comment `/chronus add` on this PR** and a bot will commit a', | |
| 'changelog entry for you, derived from your PR title.', | |
| '', | |
| 'Customise the entry kind by appending it to the command:', | |
| '', | |
| '- `/chronus add` → defaults to `internal`', | |
| '- `/chronus add fix` → bug fix', | |
| '- `/chronus add feature` → new feature', | |
| '- `/chronus add breaking` → breaking change', | |
| '- `/chronus add deprecation` → deprecation', | |
| '- `/chronus add dependencies` → dependency bump', | |
| '', | |
| '> ℹ️ For PRs from forks, run the command locally instead:', | |
| '>', | |
| '> ```bash', | |
| '> azpysdk changelog add', | |
| '> ```', | |
| '', | |
| 'See [`doc/dev/changelog_updates.md`](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/changelog_updates.md) for full instructions.', | |
| ].join('\n'); | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| }); | |
| const existing = comments.find(c => c.body && c.body.startsWith(HEADER)); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| body, | |
| }); | |
| } | |
| - name: Emit annotation on failure | |
| if: failure() && steps.verify.conclusion == 'failure' | |
| run: | | |
| echo "::error::Chronus verification failed. Comment '/chronus add' on this PR for an automated fix, or run 'azpysdk changelog add' locally." | |
| echo "::error::See https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/changelog_updates.md for instructions." |