Skip to content

Commit

Permalink
Avoid running the workflow twice on PR pushes
Browse files Browse the repository at this point in the history
When someone force-pushes to a PR or adds a new commit, the workflow would run
_twice_, as both `push` and `pull_request` events would trigger.

The default for `types` is `[opened, reopened, synchronize]`; the latter is the
type that overlaps with `push`.

In addition, existing runs for the same PR are cancelled whenever a push is made.
  • Loading branch information
mjpieters committed Mar 28, 2022
1 parent 42a5e2a commit f348ac7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -10,10 +10,16 @@ on:
branches:
- master
- ?.?*
types: [opened, reopened]
schedule:
- cron: '0 6 * * *' # Daily 6AM UTC build


concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true


jobs:

lint:
Expand Down
1 change: 1 addition & 0 deletions CHANGES/700.misc.rst
@@ -0,0 +1 @@
Updated the GitHub workflow to avoid running unnecessary extra jobs.

0 comments on commit f348ac7

Please sign in to comment.