fix: update expected PR branch format in validation step #384
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This isn't a reusable workflow but an actual CI action for this repo itself - to test the workflows. | |
| name: Workflow Tests | |
| on: | |
| push: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| actions: write | |
| jobs: | |
| # Test PR creation scenario - should create a PR with specific version pattern | |
| updater-pr-creation: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run updater action | |
| id: updater | |
| uses: ./updater | |
| with: | |
| path: updater/tests/sentry-cli.properties | |
| name: WORKFLOW-TEST-DEPENDENCY-DO-NOT-MERGE | |
| pattern: '^2\.0\.' | |
| pr-strategy: update | |
| api-token: ${{ github.token }} | |
| - name: Validate PR creation outputs | |
| env: | |
| BASE_BRANCH: ${{ steps.updater.outputs.baseBranch }} | |
| ORIGINAL_TAG: ${{ steps.updater.outputs.originalTag }} | |
| LATEST_TAG: ${{ steps.updater.outputs.latestTag }} | |
| PR_URL: ${{ steps.updater.outputs.prUrl }} | |
| PR_BRANCH: ${{ steps.updater.outputs.prBranch }} | |
| run: | | |
| echo "π Validating PR creation scenario outputs..." | |
| echo "Base Branch: '$BASE_BRANCH'" | |
| echo "Original Tag: '$ORIGINAL_TAG'" | |
| echo "Latest Tag: '$LATEST_TAG'" | |
| echo "PR URL: '$PR_URL'" | |
| echo "PR Branch: '$PR_BRANCH'" | |
| # Validate base branch is main | |
| if [[ "$BASE_BRANCH" != "main" ]]; then | |
| echo "β Expected base branch 'main', got '$BASE_BRANCH'" | |
| exit 1 | |
| fi | |
| # Validate original tag is expected test value | |
| if [[ "$ORIGINAL_TAG" != "2.0.0" ]]; then | |
| echo "β Expected original tag '2.0.0', got '$ORIGINAL_TAG'" | |
| exit 1 | |
| fi | |
| # Validate latest tag is a valid version | |
| if [[ ! "$LATEST_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "β Latest tag '$LATEST_TAG' is not a valid version format" | |
| exit 1 | |
| fi | |
| # Validate PR URL format | |
| if [[ ! "$PR_URL" =~ ^https://github\.com/getsentry/github-workflows/pull/[0-9]+$ ]]; then | |
| echo "β PR URL '$PR_URL' is not a valid GitHub PR URL" | |
| exit 1 | |
| fi | |
| # Validate PR branch format | |
| if [[ "$PR_BRANCH" != "deps/updater/tests/sentry-cli.properties" ]]; then | |
| echo "β Expected PR branch 'deps/updater/tests/sentry-cli.properties', got '$PR_BRANCH'" | |
| exit 1 | |
| fi | |
| echo "β PR creation scenario validation passed!" | |
| # Test target-branch functionality - should use specified branch as base | |
| updater-target-branch: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run updater action with target-branch | |
| id: updater | |
| uses: ./updater | |
| with: | |
| path: updater/tests/sentry-cli.properties | |
| name: TARGET-BRANCH-TEST-DO-NOT-MERGE | |
| pattern: '^2\.0\.' | |
| target-branch: test/nonbot-commits | |
| pr-strategy: update | |
| api-token: ${{ github.token }} | |
| - name: Validate target-branch outputs | |
| env: | |
| BASE_BRANCH: ${{ steps.updater.outputs.baseBranch }} | |
| ORIGINAL_TAG: ${{ steps.updater.outputs.originalTag }} | |
| LATEST_TAG: ${{ steps.updater.outputs.latestTag }} | |
| PR_URL: ${{ steps.updater.outputs.prUrl }} | |
| PR_BRANCH: ${{ steps.updater.outputs.prBranch }} | |
| run: | | |
| echo "π Validating target-branch scenario outputs..." | |
| echo "Base Branch: '$BASE_BRANCH'" | |
| echo "Original Tag: '$ORIGINAL_TAG'" | |
| echo "Latest Tag: '$LATEST_TAG'" | |
| echo "PR URL: '$PR_URL'" | |
| echo "PR Branch: '$PR_BRANCH'" | |
| # Validate base branch is the specified target-branch | |
| if [[ "$BASE_BRANCH" != "test/nonbot-commits" ]]; then | |
| echo "β Expected base branch 'test/nonbot-commits', got '$BASE_BRANCH'" | |
| exit 1 | |
| fi | |
| # Validate original tag is expected test value | |
| if [[ "$ORIGINAL_TAG" != "2.0.0" ]]; then | |
| echo "β Expected original tag '2.0.0', got '$ORIGINAL_TAG'" | |
| exit 1 | |
| fi | |
| # Validate latest tag is a valid version | |
| if [[ ! "$LATEST_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "β Latest tag '$LATEST_TAG' is not a valid version format" | |
| exit 1 | |
| fi | |
| # Validate PR URL format | |
| if [[ ! "$PR_URL" =~ ^https://github\.com/getsentry/github-workflows/pull/[0-9]+$ ]]; then | |
| echo "β PR URL '$PR_URL' is not a valid GitHub PR URL" | |
| exit 1 | |
| fi | |
| # Validate PR branch format | |
| if [[ "$PR_BRANCH" != "test/nonbot-commits-deps/updater/tests/sentry-cli.properties" ]]; then | |
| echo "β Expected PR branch 'test/nonbot-commits-deps/updater/tests/sentry-cli.properties', got '$PR_BRANCH'" | |
| exit 1 | |
| fi | |
| echo "β Target-branch scenario validation passed!" | |
| # Test no-change scenario - should detect no updates needed | |
| updater-no-changes: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run updater action | |
| id: updater | |
| uses: ./updater | |
| with: | |
| path: updater/tests/workflow-args.sh | |
| name: Workflow args test script | |
| pattern: '.*' | |
| api-token: ${{ github.token }} | |
| - name: Validate no-changes outputs | |
| env: | |
| BASE_BRANCH: ${{ steps.updater.outputs.baseBranch }} | |
| ORIGINAL_TAG: ${{ steps.updater.outputs.originalTag }} | |
| LATEST_TAG: ${{ steps.updater.outputs.latestTag }} | |
| PR_URL: ${{ steps.updater.outputs.prUrl }} | |
| PR_BRANCH: ${{ steps.updater.outputs.prBranch }} | |
| run: | | |
| echo "π Validating no-changes scenario outputs..." | |
| echo "Base Branch: '$BASE_BRANCH'" | |
| echo "Original Tag: '$ORIGINAL_TAG'" | |
| echo "Latest Tag: '$LATEST_TAG'" | |
| echo "PR URL: '$PR_URL'" | |
| echo "PR Branch: '$PR_BRANCH'" | |
| # Validate no PR was created (empty values) | |
| if [[ -n "$BASE_BRANCH" ]]; then | |
| echo "β Expected empty base branch for no-changes, got '$BASE_BRANCH'" | |
| exit 1 | |
| fi | |
| if [[ -n "$PR_URL" ]]; then | |
| echo "β Expected no PR URL for no-changes, got '$PR_URL'" | |
| exit 1 | |
| fi | |
| if [[ -n "$PR_BRANCH" ]]; then | |
| echo "β Expected no PR branch for no-changes, got '$PR_BRANCH'" | |
| exit 1 | |
| fi | |
| # Validate original equals latest (no update) | |
| if [[ "$ORIGINAL_TAG" != "$LATEST_TAG" ]]; then | |
| echo "β Expected original tag to equal latest tag, got '$ORIGINAL_TAG' != '$LATEST_TAG'" | |
| exit 1 | |
| fi | |
| # Validate tag format (should be 'latest' or valid version) | |
| if [[ "$ORIGINAL_TAG" != "latest" && ! "$ORIGINAL_TAG" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "β Original tag '$ORIGINAL_TAG' is not 'latest' or valid version format" | |
| exit 1 | |
| fi | |
| echo "β No-changes scenario validation passed!" | |
| cli-integration: | |
| runs-on: ${{ matrix.host }}-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| host: | |
| - ubuntu | |
| - macos | |
| - windows | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./sentry-cli/integration-test/ | |
| with: | |
| path: sentry-cli/integration-test/tests/ |