@@ -2,6 +2,13 @@ name: Test Autoupdate Action on Real Repo
22
33on :
44 workflow_dispatch :
5+ push :
6+ branches :
7+ - main
8+
9+ concurrency :
10+ group : prod-pr-auto-updater
11+ cancel-in-progress : true
512
613jobs :
714 test-autoupdate :
5259 gh pr create --base main --head test-non-conflict --title "Test Non-Conflict" --body "Testing non-conflicting PR" --repo "CSSUoB/autoupdate-action-unstable" --label "sync"
5360 gh pr create --base main --head test-conflict --title "Test Conflict" --body "Testing conflicting PR" --repo "CSSUoB/autoupdate-action-unstable" --label "sync"
5461 # Wait for autoupdate action to run (adjust sleep as needed)
55- sleep 120
62+ echo "Waiting for 60 seconds for autoupdate action to process PRs..."
63+ sleep 60
5664 # Get PR numbers
5765 NON_CONFLICT_PR=$(gh pr list --head test-non-conflict --json number --jq '.[0].number' --repo "CSSUoB/autoupdate-action-unstable")
5866 CONFLICT_PR=$(gh pr list --head test-conflict --json number --jq '.[0].number' --repo "CSSUoB/autoupdate-action-unstable")
6977 exit 1
7078 fi
7179 echo "Test passed: Non-conflicting PR is mergeable and conflicting PR is labelled"
80+
81+ - name : Clean up test PRs and branches
82+ if : ${{ always() }}
83+ env :
84+ GH_TOKEN : ${{ secrets.PR_AUTO_UPDATE_TOKEN }}
85+ run : |
86+ cd autoupdate-action-unstable
87+ # Get PR numbers
88+ NON_CONFLICT_PR=$(gh pr list --head test-non-conflict --json number --jq '.[0].number' --repo "CSSUoB/autoupdate-action-unstable")
89+ CONFLICT_PR=$(gh pr list --head test-conflict --json number --jq '.[0].number' --repo "CSSUoB/autoupdate-action-unstable")
90+ # Close PRs if open
91+ if [ -n "$NON_CONFLICT_PR" ]; then
92+ gh pr close "$NON_CONFLICT_PR" --delete-branch --repo "CSSUoB/autoupdate-action-unstable" || true
93+ fi
94+ if [ -n "$CONFLICT_PR" ]; then
95+ gh pr close "$CONFLICT_PR" --delete-branch --repo "CSSUoB/autoupdate-action-unstable" || true
96+ fi
97+ # Also try to delete remote branches in case PRs were already merged/closed
98+ git push origin --delete test-non-conflict || true
99+ git push origin --delete test-conflict || true
0 commit comments