Skip to content

fix: address valid review comments for robustness #350

fix: address valid review comments for robustness

fix: address valid review comments for robustness #350

Workflow file for this run

# 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 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/