Skip to content

feat(updater): Add post-update-script support #413

feat(updater): Add post-update-script support

feat(updater): Add post-update-script support #413

# 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 }}
shell: pwsh
run: |
Write-Host "πŸ” Validating PR creation scenario outputs..."
Write-Host "Base Branch: '$env:BASE_BRANCH'"
Write-Host "Original Tag: '$env:ORIGINAL_TAG'"
Write-Host "Latest Tag: '$env:LATEST_TAG'"
Write-Host "PR URL: '$env:PR_URL'"
Write-Host "PR Branch: '$env:PR_BRANCH'"
# Validate base branch is main
$env:BASE_BRANCH | Should -Be "main"
# Validate original tag is expected test value
$env:ORIGINAL_TAG | Should -Be "2.0.0"
# Validate latest tag is a valid version
$env:LATEST_TAG | Should -Match "^[0-9]+\.[0-9]+\.[0-9]+$"
# Validate PR URL format
$env:PR_URL | Should -Match "^https://github\.com/getsentry/github-workflows/pull/[0-9]+$"
# Validate PR branch format
$env:PR_BRANCH | Should -Be "deps/updater/tests/sentry-cli.properties"
Write-Host "βœ… 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 }}
shell: pwsh
run: |
Write-Host "πŸ” Validating target-branch scenario outputs..."
Write-Host "Base Branch: '$env:BASE_BRANCH'"
Write-Host "Original Tag: '$env:ORIGINAL_TAG'"
Write-Host "Latest Tag: '$env:LATEST_TAG'"
Write-Host "PR URL: '$env:PR_URL'"
Write-Host "PR Branch: '$env:PR_BRANCH'"
# Validate base branch is the specified target-branch
$env:BASE_BRANCH | Should -Be "test/nonbot-commits"
# Validate original tag is expected test value
$env:ORIGINAL_TAG | Should -Be "2.0.0"
# Validate latest tag is a valid version
$env:LATEST_TAG | Should -Match "^[0-9]+\.[0-9]+\.[0-9]+$"
# Validate PR URL format
$env:PR_URL | Should -Match "^https://github\.com/getsentry/github-workflows/pull/[0-9]+$"
# Validate PR branch format
$env:PR_BRANCH | Should -Be "test/nonbot-commits-deps/updater/tests/sentry-cli.properties"
Write-Host "βœ… 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 }}
shell: pwsh
run: |
Write-Host "πŸ” Validating no-changes scenario outputs..."
Write-Host "Base Branch: '$env:BASE_BRANCH'"
Write-Host "Original Tag: '$env:ORIGINAL_TAG'"
Write-Host "Latest Tag: '$env:LATEST_TAG'"
Write-Host "PR URL: '$env:PR_URL'"
Write-Host "PR Branch: '$env:PR_BRANCH'"
# Validate no PR was created (empty values)
$env:BASE_BRANCH | Should -BeNullOrEmpty
$env:PR_URL | Should -BeNullOrEmpty
$env:PR_BRANCH | Should -BeNullOrEmpty
# Validate original equals latest (no update)
$env:ORIGINAL_TAG | Should -Be $env:LATEST_TAG
# Validate tag format (should be 'latest' or valid version)
if ($env:ORIGINAL_TAG -ne "latest") {
$env:ORIGINAL_TAG | Should -Match "^v?[0-9]+\.[0-9]+\.[0-9]+$"
}
Write-Host "βœ… 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/