Skip to content

Commit 3c7fbc9

Browse files
authored
Workflow adjustments (#2301)
### What kind of change does this PR introduce? * Sets an output condition to prevent subsequent steps from running (without marking the workflow as `cancelled`/`failed`). * Addresses a concurrency issue that occurs when a `pull_request_review` event cancels a `pull_request` triggered build. * Completely removes `ubuntu-slim` (not compatible with `step-security/harden-runner`). ### Does this PR introduce a breaking change? Pull request reviews will no longer cancel workflows that have been trigger via `pull_request` events (`synchronize`). This should make things a bit easier. ### Other information: Given that this workflow performs a checkout and creates tokens using secrets, we should not be allowing `pull_request_target` as an allowed trigger.
2 parents a7b294f + ebcfc90 commit 3c7fbc9

File tree

7 files changed

+13
-7
lines changed

7 files changed

+13
-7
lines changed

.github/workflows/add-to-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111
jobs:
1212
add-to-project:
1313
name: Add Issue to xclim Project
14-
runs-on: ubuntu-slim
14+
runs-on: ubuntu-latest
1515
permissions:
1616
repository-projects: write
1717
steps:

.github/workflows/auto-accept-ci-changes.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,23 @@ jobs:
4242
github-token: ${{ steps.token_generator.outputs.token }}
4343

4444
- name: Stop workflow if not minor update or patch update
45+
id: skip-condition
4546
if: >
4647
steps.dependabot-metadata.outputs.update-type != 'version-update:semver-minor' &&
4748
steps.dependabot-metadata.outputs.update-type != 'version-update:semver-patch'
4849
run: |
4950
echo "Not a minor or patch update; skipping auto-approval."
50-
exit 0
51+
echo "skip=true" >> $GITHUB_OUTPUT
5152
5253
- name: Checkout Repository
54+
if: ${{ steps.skip-condition.outputs.skip != 'true' }}
5355
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
5456
with:
5557
token: ${{ steps.token_generator.outputs.token }}
5658
persist-credentials: false
5759

5860
- name: Approve Pull Request if not already approved
61+
if: ${{ steps.skip-condition.outputs.skip != 'true' }}
5962
run: |
6063
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ];
6164
then gh pr review --approve "$PR_URL"
@@ -66,6 +69,7 @@ jobs:
6669
PR_URL: ${{github.event.pull_request.html_url}}
6770

6871
- name: Enable auto-merge
72+
if: ${{ steps.skip-condition.outputs.skip != 'true' }}
6973
run: |
7074
gh pr merge --auto --merge "$PR_URL"
7175
env:

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ env:
2222
XCLIM_TESTDATA_BRANCH: v2025.4.29
2323

2424
concurrency:
25-
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch except on main.
26-
group: "${{ github.workflow }}-${{ github.ref }}"
25+
# For a given workflow, if we push to the same branch, from the same event family, cancel all previous builds on that branch except on main.
26+
group: "${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}"
2727
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
2828

2929
permissions:

.github/workflows/publish-mastodon.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111
jobs:
1212
toot:
1313
name: Generate Mastodon Toot
14-
runs-on: ubuntu-slim
14+
runs-on: ubuntu-latest
1515
environment: production
1616
steps:
1717
- name: Harden Runner

.github/workflows/testdata-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ permissions:
1515
jobs:
1616
use-latest-tag:
1717
name: Check Latest xclim-testdata Tag
18-
runs-on: ubuntu-slim
18+
runs-on: ubuntu-latest
1919
if: |
2020
(github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name)
2121
permissions:

.github/workflows/workflow-warning.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ permissions:
1818
jobs:
1919
comment-concerning-workflow-changes:
2020
name: Comment Concerning Workflow Changes
21-
runs-on: ubuntu-slim
21+
runs-on: ubuntu-latest
2222
if: |
2323
(github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name)
2424
permissions:

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Internal changes
2727
* The configuration in `tox.toml` now uses the new TOML conventions.
2828
* `--strict-config` and `--strict-markers` have been replaced with the new `--strict` mode. For more information, refer to the `pytest documentation <https://docs.pytest.org/en/stable/reference/reference.html#confval-strict>`_.
2929
* Added a GitHub Workflow for automatically approving Dependabot Pull Requests that are either `patch` or `minor` updates. Dependabot is now configured to run on a monthly basis (previously weekly). (:pull:`2292`).
30+
* Dependabot `auto-approved` pull requests are now also set to `auto-merge`. (:pull:`2300`).
31+
* Build-cancelling based on concurrency rules for the `main.yml` GitHub Workflow is now divided according to the `github.event_name` (`pull_request`, `pull_request_review`). (:pull:`2301`).
3032

3133
v0.59.1 (2025-10-31)
3234
--------------------

0 commit comments

Comments
 (0)