@@ -10,7 +10,8 @@ permissions:
1010 issues : write
1111
1212jobs :
13- updater-create-pr :
13+ # Test PR creation scenario - should create a PR with specific version pattern
14+ test-updater-pr-creation :
1415 runs-on : ubuntu-latest
1516 outputs :
1617 prUrl : ${{ steps.updater.outputs.prUrl }}
1920 originalTag : ${{ steps.updater.outputs.originalTag }}
2021 latestTag : ${{ steps.updater.outputs.latestTag }}
2122 steps :
22- - uses : actions/checkout@v4
23- - name : Run updater action
23+ - name : Checkout repository
24+ uses : actions/checkout@v4
25+
26+ - name : Test updater - PR creation scenario
2427 id : updater
2528 uses : ./updater
2629 with :
3033 pr-strategy : update
3134 api-token : ${{ github.token }}
3235
33- updater-test-args :
36+ # Test no-change scenario - should detect no updates needed
37+ test-updater-no-changes :
3438 runs-on : macos-latest
3539 outputs :
3640 prUrl : ${{ steps.updater.outputs.prUrl }}
3943 originalTag : ${{ steps.updater.outputs.originalTag }}
4044 latestTag : ${{ steps.updater.outputs.latestTag }}
4145 steps :
42- - uses : actions/checkout@v4
43- - name : Run updater action
46+ - name : Checkout repository
47+ uses : actions/checkout@v4
48+
49+ - name : Test updater - no changes scenario
4450 id : updater
4551 uses : ./updater
4652 with :
@@ -49,23 +55,103 @@ jobs:
4955 pattern : ' .*'
5056 api-token : ${{ github.token }}
5157
52- updater -test-outputs :
58+ validate -test-outputs :
5359 runs-on : ubuntu-latest
5460 needs :
55- - updater-create-pr
56- - updater-test-args
61+ - test- updater-pr-creation
62+ - test- updater-no-changes
5763 steps :
58- - run : " [[ '${{ needs.updater-create-pr.outputs.baseBranch }}' == 'main' ]]"
59- - run : " [[ '${{ needs.updater-create-pr.outputs.originalTag }}' == '2.0.0' ]]"
60- - run : " [[ '${{ needs.updater-create-pr.outputs.latestTag }}' =~ ^[0-9.]+$ ]]"
61- - run : " [[ '${{ needs.updater-create-pr.outputs.prUrl }}' =~ ^https://github.com/getsentry/github-workflows/pull/[0-9]+$ ]]"
62- - run : " [[ '${{ needs.updater-create-pr.outputs.prBranch }}' == 'deps/updater/tests/sentry-cli.properties' ]]"
63-
64- - run : " [[ '${{ needs.updater-test-args.outputs.baseBranch }}' == '' ]]"
65- - run : " [[ '${{ needs.updater-test-args.outputs.originalTag }}' == 'latest' || '${{ needs.updater-test-args.outputs.originalTag }}' =~ ^v?[0-9]+\\ .[0-9]+\\ .[0-9]+$ ]]"
66- - run : " [[ '${{ needs.updater-test-args.outputs.originalTag }}' == '${{ needs.updater-test-args.outputs.latestTag }}' ]]"
67- - run : " [[ '${{ needs.updater-test-args.outputs.prUrl }}' == '' ]]"
68- - run : " [[ '${{ needs.updater-test-args.outputs.prBranch }}' == '' ]]"
64+ - name : Validate PR creation scenario outputs
65+ env :
66+ BASE_BRANCH : ${{ needs.test-updater-pr-creation.outputs.baseBranch }}
67+ ORIGINAL_TAG : ${{ needs.test-updater-pr-creation.outputs.originalTag }}
68+ LATEST_TAG : ${{ needs.test-updater-pr-creation.outputs.latestTag }}
69+ PR_URL : ${{ needs.test-updater-pr-creation.outputs.prUrl }}
70+ PR_BRANCH : ${{ needs.test-updater-pr-creation.outputs.prBranch }}
71+ run : |
72+ echo "🔍 Validating PR creation scenario outputs..."
73+ echo "Base Branch: '$BASE_BRANCH'"
74+ echo "Original Tag: '$ORIGINAL_TAG'"
75+ echo "Latest Tag: '$LATEST_TAG'"
76+ echo "PR URL: '$PR_URL'"
77+ echo "PR Branch: '$PR_BRANCH'"
78+
79+ # Validate base branch is main
80+ if [[ "$BASE_BRANCH" != "main" ]]; then
81+ echo "❌ Expected base branch 'main', got '$BASE_BRANCH'"
82+ exit 1
83+ fi
84+
85+ # Validate original tag is expected test value
86+ if [[ "$ORIGINAL_TAG" != "2.0.0" ]]; then
87+ echo "❌ Expected original tag '2.0.0', got '$ORIGINAL_TAG'"
88+ exit 1
89+ fi
90+
91+ # Validate latest tag is a valid version
92+ if [[ ! "$LATEST_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
93+ echo "❌ Latest tag '$LATEST_TAG' is not a valid version format"
94+ exit 1
95+ fi
96+
97+ # Validate PR URL format
98+ if [[ ! "$PR_URL" =~ ^https://github\.com/getsentry/github-workflows/pull/[0-9]+$ ]]; then
99+ echo "❌ PR URL '$PR_URL' is not a valid GitHub PR URL"
100+ exit 1
101+ fi
102+
103+ # Validate PR branch format
104+ if [[ "$PR_BRANCH" != "deps/updater/tests/sentry-cli.properties" ]]; then
105+ echo "❌ Expected PR branch 'deps/updater/tests/sentry-cli.properties', got '$PR_BRANCH'"
106+ exit 1
107+ fi
108+
109+ echo "✅ PR creation scenario validation passed!"
110+
111+ - name : Validate no-changes scenario outputs
112+ env :
113+ BASE_BRANCH : ${{ needs.test-updater-no-changes.outputs.baseBranch }}
114+ ORIGINAL_TAG : ${{ needs.test-updater-no-changes.outputs.originalTag }}
115+ LATEST_TAG : ${{ needs.test-updater-no-changes.outputs.latestTag }}
116+ PR_URL : ${{ needs.test-updater-no-changes.outputs.prUrl }}
117+ PR_BRANCH : ${{ needs.test-updater-no-changes.outputs.prBranch }}
118+ run : |
119+ echo "🔍 Validating no-changes scenario outputs..."
120+ echo "Base Branch: '$BASE_BRANCH'"
121+ echo "Original Tag: '$ORIGINAL_TAG'"
122+ echo "Latest Tag: '$LATEST_TAG'"
123+ echo "PR URL: '$PR_URL'"
124+ echo "PR Branch: '$PR_BRANCH'"
125+
126+ # Validate no PR was created (empty values)
127+ if [[ -n "$BASE_BRANCH" ]]; then
128+ echo "❌ Expected empty base branch for no-changes, got '$BASE_BRANCH'"
129+ exit 1
130+ fi
131+
132+ if [[ -n "$PR_URL" ]]; then
133+ echo "❌ Expected no PR URL for no-changes, got '$PR_URL'"
134+ exit 1
135+ fi
136+
137+ if [[ -n "$PR_BRANCH" ]]; then
138+ echo "❌ Expected no PR branch for no-changes, got '$PR_BRANCH'"
139+ exit 1
140+ fi
141+
142+ # Validate original equals latest (no update)
143+ if [[ "$ORIGINAL_TAG" != "$LATEST_TAG" ]]; then
144+ echo "❌ Expected original tag to equal latest tag, got '$ORIGINAL_TAG' != '$LATEST_TAG'"
145+ exit 1
146+ fi
147+
148+ # Validate tag format (should be 'latest' or valid version)
149+ if [[ "$ORIGINAL_TAG" != "latest" && ! "$ORIGINAL_TAG" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
150+ echo "❌ Original tag '$ORIGINAL_TAG' is not 'latest' or valid version format"
151+ exit 1
152+ fi
153+
154+ echo "✅ No-changes scenario validation passed!"
69155
70156 cli-integration :
71157 runs-on : ${{ matrix.host }}-latest
0 commit comments