Skip to content

Commit a522fb9

Browse files
committed
CI: don't run duplicate tests on PRs
Use skip-duplicate-actions to avoid re-running tests if code hasn't changed. (Also avoids running tests twice on push that opens a PR.)
1 parent 614eb9e commit a522fb9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,35 @@ name: test
33
on:
44
push:
55
pull_request:
6+
workflow_dispatch:
67
schedule:
78
# Weekly build (on branch main) every Thursday at 12:00 UTC.
89
# (Used to monitor compatibility with ESP APIs and other dependencies.)
910
- cron: '0 12 * * 4'
1011

1112

1213
jobs:
14+
skip_duplicate_runs:
15+
# Avoid running the tests twice on the same code
16+
# (particularly live integration tests that eat up ESP test quota)
17+
runs-on: ubuntu-18.04
18+
outputs:
19+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
20+
steps:
21+
- id: skip_check
22+
# uses: fkirc/[email protected]
23+
uses: fkirc/skip-duplicate-actions@ea548f2a2a08c55dcb111418ca62181f7887e297
24+
with:
25+
concurrent_skipping: "same_content"
26+
skip_after_successful_duplicate: "true"
27+
cancel_others: "true"
28+
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
29+
1330
test:
1431
name: ${{ matrix.config.tox }} ${{ matrix.config.options }}
1532
runs-on: ubuntu-18.04
33+
needs: skip_duplicate_runs
34+
if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }}
1635
timeout-minutes: 15
1736
strategy:
1837
fail-fast: false

0 commit comments

Comments
 (0)