Skip to content

Commit 24f5169

Browse files
authored
ci: Run diff-shades on unstable instead of preview (#4741)
Signed-off-by: cobalt <[email protected]>
1 parent 4d55e60 commit 24f5169

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

.github/workflows/diff_shades.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ jobs:
129129
path: ${{ matrix.target-analysis }}
130130

131131
- name: Generate summary file (PR only)
132-
if: github.event_name == 'pull_request' && matrix.mode == 'preview-changes'
132+
if: github.event_name == 'pull_request' && matrix.mode == 'preview-new-changes'
133133
run: >
134134
python helper.py comment-body ${{ matrix.baseline-analysis }}
135135
${{ matrix.target-analysis }} ${{ matrix.baseline-sha }}
136136
${{ matrix.target-sha }} ${{ github.event.pull_request.number }}
137137
138138
- name: Upload summary file (PR only)
139-
if: github.event_name == 'pull_request' && matrix.mode == 'preview-changes'
139+
if: github.event_name == 'pull_request' && matrix.mode == 'preview-new-changes'
140140
uses: actions/upload-artifact@v4
141141
with:
142142
name: .pr-comment.json

docs/contributing/gauging_changes.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ workflow that analyzes and compares two revisions of _Black_ according to these
2727
| On PRs | latest commit on `main` | PR commit with `main` merged |
2828
| On pushes (main only) | latest PyPI version | the pushed commit |
2929

30-
For pushes to main, there's only one analysis job named `preview-changes` where the
31-
preview style is used for all projects.
30+
For pushes to main, there's only one analysis job named `preview-new-changes` where the
31+
unstable style is used for all projects.
3232

3333
For PRs they get one more analysis job: `assert-no-changes`. It's similar to
34-
`preview-changes` but runs with the stable code style. It will fail if changes were
34+
`preview-new-changes` but runs with the stable code style. It will fail if changes were
3535
made. This makes sure code won't be reformatted again and again within the same year in
3636
accordance to Black's stability policy.
3737

38-
Additionally for PRs, a PR comment will be posted embedding a summary of the preview
39-
changes and links to further information. If there's a pre-existing diff-shades comment,
40-
it'll be updated instead the next time the workflow is triggered on the same PR.
38+
Additionally for PRs, a PR comment will be posted embedding a summary previewing the
39+
changes in the unstable style and links to further information. The next time the
40+
workflow is triggered on the same PR, it'll update the pre-existing diff-shades comment.
4141

4242
```{note}
43-
The `preview-changes` job will only fail intentionally if while analyzing a file failed to
43+
The `preview-new-changes` job will only fail intentionally if while analyzing a file failed to
4444
format. Otherwise a failure indicates a bug in the workflow.
4545
```
4646

scripts/diff_shades_gha_helper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def config(event: Literal["push", "pull_request"]) -> None:
117117
import diff_shades # type: ignore[import-not-found]
118118

119119
if event == "push":
120-
jobs = [{"mode": "preview-changes", "force-flag": "--force-preview-style"}]
120+
jobs = [{"mode": "preview-new-changes", "force-flag": "--force-unstable-style"}]
121121
# Push on main, let's use PyPI Black as the baseline.
122122
baseline_name = str(get_pypi_version())
123123
baseline_cmd = f"git checkout {baseline_name}"
@@ -128,7 +128,7 @@ def config(event: Literal["push", "pull_request"]) -> None:
128128

129129
elif event == "pull_request":
130130
jobs = [
131-
{"mode": "preview-changes", "force-flag": "--force-preview-style"},
131+
{"mode": "preview-new-changes", "force-flag": "--force-unstable-style"},
132132
{"mode": "assert-no-changes", "force-flag": "--force-stable-style"},
133133
]
134134
# PR, let's use main as the baseline.
@@ -205,7 +205,7 @@ def comment_details(run_id: str) -> None:
205205

206206
set_output("needs-comment", "true")
207207
jobs = http_get(data["jobs_url"])["jobs"]
208-
job = next(j for j in jobs if j["name"] == "analysis / preview-changes")
208+
job = next(j for j in jobs if j["name"] == "analysis / preview-new-changes")
209209
diff_step = next(s for s in job["steps"] if s["name"] == DIFF_STEP_NAME)
210210
diff_url = job["html_url"] + f"#step:{diff_step['number']}:1"
211211

0 commit comments

Comments
 (0)