@@ -2,6 +2,13 @@ name: Test Autoupdate Action on Real Repo
2
2
3
3
on :
4
4
workflow_dispatch :
5
+ push :
6
+ branches :
7
+ - main
8
+
9
+ concurrency :
10
+ group : prod-pr-auto-updater
11
+ cancel-in-progress : true
5
12
6
13
jobs :
7
14
test-autoupdate :
52
59
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"
53
60
gh pr create --base main --head test-conflict --title "Test Conflict" --body "Testing conflicting PR" --repo "CSSUoB/autoupdate-action-unstable" --label "sync"
54
61
# 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
56
64
# Get PR numbers
57
65
NON_CONFLICT_PR=$(gh pr list --head test-non-conflict --json number --jq '.[0].number' --repo "CSSUoB/autoupdate-action-unstable")
58
66
CONFLICT_PR=$(gh pr list --head test-conflict --json number --jq '.[0].number' --repo "CSSUoB/autoupdate-action-unstable")
69
77
exit 1
70
78
fi
71
79
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