Skip to content

Commit

Permalink
Labeling fixes, Use Concurrency to cancel workflows (#1487)
Browse files Browse the repository at this point in the history
### What kind of change does this PR introduce?

* Fixes a bug that was recognizing all PRs as though they were coming
from forks of Ouranosinc/xclim
* Removes credentials from the actions-version-updater.yml so that I
don't get the commit credit (and cannot approve the resulting PR)
* Replace the styfle/cancel-workflow-action with concurrency
  • Loading branch information
Zeitsperre authored Oct 6, 2023
2 parents 0ce4d30 + 318e293 commit 556cc80
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/actions-versions-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
- uses: actions/[email protected]
with:
token: ${{ secrets.WORKFLOW_TOKEN }}
persist-credentials: false
- name: Run GitHub Actions Version Updater
uses: saadmk11/[email protected]
with:
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/label_on_approval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
comment_approved:
name: Comment Concerning Approved Tag
if: |
(github.event_name == 'pull_request_target') ||
(github.event_name == 'pull_request_target') &&
(github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name)
runs-on: ubuntu-latest
steps:
Expand All @@ -50,8 +50,9 @@ jobs:
body-includes: This Pull Request is coming from a fork and must be manually tagged `approved` in order to perform additional testing
- name: Create comment
if: |
(steps.fc.outputs.comment-id == '') ||
(!contains(github.event.pull_request.labels.*.name, 'approved'))
(steps.fc.outputs.comment-id == '') &&
(!contains(github.event.pull_request.labels.*.name, 'approved')) &&
(github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name)
uses: peter-evans/[email protected]
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
Expand All @@ -68,7 +69,8 @@ jobs:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Pull Request is approved!
> **Note**
> This Pull Request is approved!
reactions: |
hooray
edit-mode: append
9 changes: 5 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
env:
XCLIM_TESTDATA_BRANCH: v2023.9.12

concurrency:
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch except on master.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
lint:
name: Black (Python${{ matrix.python-version }})
Expand All @@ -35,10 +40,6 @@ jobs:
python-version:
- "3.8"
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/[email protected]
- name: Set up Python${{ matrix.python-version }}
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-mastodon.template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
New #xclim release: v{{ .version }} 🎉
New #xclim release: {{ .version }} 🎉

Latest source code available at: https://github.com/Ouranosinc/xclim/releases/tag/{{ .version }}
Check out the docs for more information: https://xclim.readthedocs.io/en/stable/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-mastodon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
type: boolean

jobs:
build:
toot:
runs-on: ubuntu-latest
environment: production
steps:
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Internal changes
* Changes to the ``.zenodo.json`` file no longer are marked as CI-related changes. (:pull:`1479`).
* GitHub deployment workflows now employs use of deployment environments for workflow security and uses the `Trusted Publisher <https://docs.pypi.org/trusted-publishers/using-a-publisher/>`_ feature to sign and publish the `xclim` wheel and source distributions. (:pull:`1469`).
* Mastodon publishing now uses `chuhlomin/render-template <https://github.com/chuhlomin/render-template>`_ and a standard formatting markdown document to format Mastodon toots. (:pull:`1469`).

* GitHub testing workflows now use `Concurrency` instead of the styfle/cancel-workflow-action to cancel redundant workflows. (:pull:`1487`).

v0.45.0 (2023-09-05)
--------------------
Expand Down

0 comments on commit 556cc80

Please sign in to comment.