Skip to content

Commit 9a85d88

Browse files
l0lawrenceCopilot
andcommitted
Add Chronus Verify CI workflow and update changelog docs to reference azpysdk changelog
- Add .github/workflows/chronus-verify.yml that enforces change descriptions on PRs touching sdk/*/*/** - Update doc/dev/changelog_updates.md to recommend azpysdk changelog as primary tool Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 15d9064 commit 9a85d88

2 files changed

Lines changed: 133 additions & 10 deletions

File tree

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Chronus Verify
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- "sdk/*/*/**"
8+
9+
concurrency:
10+
group: chronus-verify-${{ github.event.pull_request.number }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
chronus-verify:
15+
name: Verify Chronus Change Descriptions
16+
if: github.event.pull_request.user.login != 'azure-sdk'
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
issues: write
21+
steps:
22+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
with:
24+
fetch-depth: 0 # needed so chronus can diff against base branch
25+
persist-credentials: false
26+
27+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
28+
with:
29+
node-version: "22"
30+
cache: npm
31+
cache-dependency-path: .github/chronus/package-lock.json
32+
33+
- name: Install pinned dependencies
34+
run: npm ci
35+
working-directory: .github/chronus
36+
37+
- name: Run chronus verify
38+
id: verify
39+
run: npm exec --no --prefix .github/chronus/ -- chronus verify
40+
41+
# Sticky comment is only post-able when GITHUB_TOKEN has write scope —
42+
# i.e. PRs from the main repo. Fork PRs see only the error annotation below.
43+
- name: Post sticky fix-instructions PR comment on failure
44+
if: failure() && steps.verify.conclusion == 'failure' && github.event.pull_request.head.repo.full_name == github.repository
45+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
46+
with:
47+
script: |
48+
const HEADER = '<!-- chronus-verify-sticky -->';
49+
const body = [
50+
HEADER,
51+
'### 📝 Missing changelog entry',
52+
'',
53+
'This PR touches package source under `sdk/*/*/**` but no Chronus',
54+
'change description was found. CI requires every user-affecting',
55+
'change to have one.',
56+
'',
57+
'#### How to fix',
58+
'',
59+
'Run the following from the repo root (or from within the package',
60+
'directory) and push the new `.chronus/changes/*.md` file:',
61+
'',
62+
'```bash',
63+
'azpysdk changelog add',
64+
'```',
65+
'',
66+
'This adds a change entry for each modified package. If your change',
67+
'is not user-facing (e.g. tests or docs only), choose the `internal`',
68+
'kind to satisfy the check without bumping the version.',
69+
'',
70+
'> 💡 You can also ask **GitHub Copilot** to fix this failing check',
71+
'> for you directly from the PR\'s *Checks* tab.',
72+
'',
73+
'See [`doc/dev/changelog_updates.md`](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/changelog_updates.md) for full instructions.',
74+
].join('\n');
75+
76+
const comments = await github.paginate(github.rest.issues.listComments, {
77+
owner: context.repo.owner,
78+
repo: context.repo.repo,
79+
issue_number: context.payload.pull_request.number,
80+
});
81+
const existing = comments.find(c => c.body && c.body.startsWith(HEADER));
82+
if (existing) {
83+
await github.rest.issues.updateComment({
84+
owner: context.repo.owner,
85+
repo: context.repo.repo,
86+
comment_id: existing.id,
87+
body,
88+
});
89+
} else {
90+
await github.rest.issues.createComment({
91+
owner: context.repo.owner,
92+
repo: context.repo.repo,
93+
issue_number: context.payload.pull_request.number,
94+
body,
95+
});
96+
}
97+
98+
- name: Emit annotation on failure
99+
if: failure() && steps.verify.conclusion == 'failure'
100+
run: |
101+
echo "::error::Chronus verification failed. Run 'azpysdk changelog add' locally and push the new .chronus/changes/*.md file, or ask GitHub Copilot to fix this check from the PR's Checks tab."
102+
echo "::error::See https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/changelog_updates.md for instructions."

doc/dev/changelog_updates.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,23 @@ The repository configuration lives in [`.chronus/config.yaml`](https://github.co
1010

1111
## Prerequisites
1212

13-
Chronus is distributed as an npm package. To use it, you need [Node.js](https://nodejs.org/) installed (LTS version recommended). You can then run Chronus without a global install using `npx`:
13+
The recommended way to interact with Chronus is through the `azpysdk` CLI, which is already available in this repository's developer environment and handles installing Chronus automatically.
14+
15+
If you prefer to invoke Chronus directly, it is distributed as an npm package and requires [Node.js](https://nodejs.org/) (LTS version recommended). You can run it without a global install using `npx`:
1416

1517
```bash
1618
npx chronus <command>
1719
```
1820

19-
Alternatively, install it globally:
21+
## Adding a Change Description
22+
23+
When you make changes to a package that has a `pyproject.toml`, add a change description by running the following from the repository root or from within the package directory:
2024

2125
```bash
22-
npm install -g @chronus/chronus
26+
azpysdk changelog add
2327
```
2428

25-
## Adding a Change Description
26-
27-
When you make changes to a package that has a `pyproject.toml`, run `chronus add` from the root of the repository:
29+
Alternatively, using raw Chronus:
2830

2931
```bash
3032
npx chronus add
@@ -55,7 +57,13 @@ The following change kinds are defined for this repository:
5557
5658
### Specifying a Package Directly
5759

58-
You can skip the interactive prompt by passing the package path(s) directly:
60+
You can skip the interactive prompt by passing the package path and change details directly:
61+
62+
```bash
63+
azpysdk changelog add sdk/storage/azure-storage-blob --kind fix --message "Fixed upload failure on large files"
64+
```
65+
66+
Or using raw Chronus:
5967

6068
```bash
6169
npx chronus add sdk/storage/azure-storage-blob
@@ -65,9 +73,9 @@ npx chronus add sdk/storage/azure-storage-blob
6573

6674
```bash
6775
# After making changes to azure-storage-blob, add a change description
68-
npx chronus add sdk/storage/azure-storage-blob
76+
azpysdk changelog add sdk/storage/azure-storage-blob
6977

70-
# Chronus will prompt you:
78+
# You will be prompted to select:
7179
# ? What kind of change is this? › fix
7280
# ? Describe the change: › Fixed an issue where upload would fail on large files
7381
```
@@ -90,17 +98,30 @@ You commit this file along with your code changes.
9098

9199
To check whether all modified packages have a corresponding change description (e.g., before opening a PR), run:
92100

101+
```bash
102+
azpysdk changelog verify
103+
```
104+
105+
Or using raw Chronus:
106+
93107
```bash
94108
npx chronus verify
95109
```
96110

111+
> **Note:** The CI workflow (`Chronus Verify`) runs `chronus verify` automatically on every pull request that modifies source files under `sdk/` (specifically files matching `sdk/*/*/**`). If it fails, run `azpysdk changelog add` locally and push the resulting `.chronus/changes/*.md` file. You can also ask GitHub Copilot to fix the failing check directly from the pull request's *Checks* tab.
97112
98113
If your changes don't need a changelog entry (e.g., pure documentation or test-only changes unrelated to package behavior), you can add an `internal` change kind entry to satisfy the requirement without bumping the version.
99114

100115
## Viewing the Current Status
101116

102117
To see a summary of all pending changes and the resulting version bumps:
103118

119+
```bash
120+
azpysdk changelog status
121+
```
122+
123+
Or using raw Chronus:
124+
104125
```bash
105126
npx chronus status
106127
```
@@ -109,7 +130,7 @@ npx chronus status
109130

110131
Packages in this repository that use `pyproject.toml` (instead of or alongside `setup.py`) are fully supported by Chronus. The `pyproject.toml` is used for package metadata, while the `CHANGELOG.md` in the package directory remains the canonical user-facing changelog.
111132

112-
Chronus reads the package version from the Python package metadata and writes changelog entries into the `CHANGELOG.md` file with `npx chronus changelog`. You do not need to manually edit `CHANGELOG.md` for your changes.
133+
Chronus reads the package version from the Python package metadata and writes changelog entries into the `CHANGELOG.md` file with `azpysdk changelog create` (or `npx chronus changelog`). You do not need to manually edit `CHANGELOG.md` for your changes.
113134

114135
## Further Reading
115136

0 commit comments

Comments
 (0)