Remove PR action not consistently working as expected
See original GitHub issueBug Description
Our GitHub Action to remove built artifacts for PRs from the wiki is not working as expected. This is resulting in the wiki growing very large in size which is also slowing down the time to clone it in our builds substantially.
Steps to reproduce
- View checks of a closed PR
- See
remove-prjob failed
e.g. https://github.com/google/site-kit-wp/runs/696936169?check_suite_focus=true
Screenshots

Additional Context
The job fails due to the push failing “error: failed to push some refs to ‘https://github.com/google/site-kit-wp.wiki’” due to missing commits. This may be due to the build-pr job running again when the PR is merged at the same time. Looking at the commits on the wiki, there are cases where PRs are removed successfully (e.g. 1583), so there may be a bit of a race condition.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The
remove-prjob should always run when a PR is closed, regardless of build or other action success states
Implementation Brief
- Set the
remove-prjob’sifto run${{ always() }}
By default this is set to${{ success() }}but we want this to always run regardless if other steps failed or not as the PR is closed - Merge #1804
Note: artifacts deployed to the wiki from previous jobs where remove-pr failed will need to be removed manually.
Paths to clean up
Found files from 51 PRs that are closed and should be removed
[ 'refs/pull/1123',
'refs/pull/1162',
'refs/pull/1166',
'refs/pull/1189',
'refs/pull/1197',
'refs/pull/1199',
'refs/pull/1200',
'refs/pull/1203',
'refs/pull/1205',
'refs/pull/1206',
'refs/pull/1216',
'refs/pull/1217',
'refs/pull/1218',
'refs/pull/1220',
'refs/pull/1226',
'refs/pull/1227',
'refs/pull/1228',
'refs/pull/1234',
'refs/pull/1239',
'refs/pull/1240',
'refs/pull/1243',
'refs/pull/1252',
'refs/pull/1284',
'refs/pull/1303',
'refs/pull/1306',
'refs/pull/1312',
'refs/pull/1329',
'refs/pull/1353',
'refs/pull/1359',
'refs/pull/1360',
'refs/pull/1413',
'refs/pull/1431',
'refs/pull/1442',
'refs/pull/1453',
'refs/pull/1457',
'refs/pull/1467',
'refs/pull/1473',
'refs/pull/1485',
'refs/pull/1496',
'refs/pull/1528',
'refs/pull/1544',
'refs/pull/1551',
'refs/pull/1562',
'refs/pull/1564',
'refs/pull/1570',
'refs/pull/1634',
'refs/pull/1664',
'refs/pull/1665',
'refs/pull/1679',
'refs/pull/1732',
'refs/pull/1763' ]
Found files from 2 branches that should be removed
[ 'refs/heads/1436',
'refs/heads/fix' ]
QA Brief
Changelog entry
- N/A
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)

Top Related StackOverflow Question
I already removed the old ones manually 👍
One important thing to check is that the job works when the checks previously failed. This seems to be the main reason why there were leftover artifacts because GHA don’t run when previous checks fail by default.
I think this is working as the actions are running so marking as approved ✅