Skip to content

Commit 2db2c21

Browse files
authored
fix: Don’t test draft PRs. Don’t do multiple “Test” runs at once. (#108)
Part of github/continuous-ai-for-accessibility#31 (Hubber access only). This PR prevents a ‘thundering herd’-like problem: A PR would trigger the “Test” workflow which, in turn, opens 6 more PRs which, in turn, each trigger “Test” and open more PRs, etc. It does this by early-exiting for draft PRs (like the 6). (Additionally, these cascading “Test” runs would always fail: The PRs fix issues, so assertions re: number of known/expected findings in “site-with-issues” fail.) This PR also modifies workflow triggers to reduce instances where the same code is tested twice. For example, since this repo enforces PRs, `on.push.main` was redundant. This conserves our request quota. This PR also prevents multiple “Test” workflows from running at once (which would cause cache collisions). It continues to allow multiple sites to be scanned concurrently _within_ a workflow run (which does not cause cache collisions).
2 parents e2812ed + 5e853b3 commit 2db2c21

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,27 @@ name: Test
22
on:
33
pull_request:
44
types:
5+
- opened
6+
- reopened
57
- synchronize
6-
push:
7-
branches:
8-
- main
8+
- ready_for_review
99
workflow_dispatch:
1010

1111
permissions:
1212
contents: write
1313
issues: write
1414
pull-requests: write
1515

16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: false # Allow previous workflows’ clean-up steps to complete
19+
1620
jobs:
1721
test:
1822
name: Test
1923
runs-on: ubuntu-latest
24+
# Run if triggered manually, or for a non-draft PR
25+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
2026
strategy:
2127
matrix:
2228
site: [ "sites/site-with-errors" ]

0 commit comments

Comments
 (0)