From 1149fd29a6f183735b3fe1fa319202a8b36c2cc1 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 10:47:55 +0200 Subject: [PATCH 01/14] feat: allow updater to target non-default branches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for `target-branch` input parameter to allow dependency updates on branches other than the repository's default branch. This enables updating alpha, beta, or version-specific branches. - Add `target-branch` input parameter to action.yml - Modify base branch detection to use target-branch when provided - Update README with parameter documentation and usage example - Add workflow test for target-branch functionality Fixes #87 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/workflow-tests.yml | 64 ++++++++++++++++++++++++++++ updater/README.md | 16 +++++++ updater/action.yml | 11 ++++- 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow-tests.yml b/.github/workflows/workflow-tests.yml index 0688d5fc..74ba8d1c 100644 --- a/.github/workflows/workflow-tests.yml +++ b/.github/workflows/workflow-tests.yml @@ -73,6 +73,70 @@ jobs: 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-branch + 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-branch" ]]; then + echo "❌ Expected base branch 'test-branch', 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 "✅ Target-branch scenario validation passed!" + # Test no-change scenario - should detect no updates needed updater-no-changes: runs-on: macos-latest diff --git a/updater/README.md b/updater/README.md index 9c517ea6..c3482b6b 100644 --- a/updater/README.md +++ b/updater/README.md @@ -82,6 +82,18 @@ jobs: path: vendor/dependencies.cmake#googletest name: GoogleTest api-token: ${{ secrets.CI_DEPLOY_KEY }} + + # Update dependencies on a non-default branch (e.g., alpha, beta, or version branches) + cocoa-v7: + runs-on: ubuntu-latest + steps: + - uses: getsentry/github-workflows/updater@v3 + with: + path: modules/sentry-cocoa + name: Cocoa SDK + target-branch: v7 + pattern: '^1\.' # Limit to major version '1' + api-token: ${{ secrets.CI_DEPLOY_KEY }} ``` ## Inputs @@ -118,6 +130,10 @@ jobs: Can be either of the following: * `create` (default) - create a new PR for new dependency versions as they are released - maintainers may merge or close older PRs manually * `update` - keep a single PR that gets updated with new dependency versions until merged - only the latest version update is available at any time +* `target-branch`: Branch to use as base for dependency updates. Defaults to repository default branch if not specified. + * type: string + * required: false + * default: '' (uses repository default branch) * `api-token`: Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}`. If you provide the usual `${{ github.token }}`, no followup CI will run on the created PR. If you want CI to run on the PRs created by the Updater, you need to provide custom user-specific auth token. diff --git a/updater/action.yml b/updater/action.yml index b3f21ad5..2f0cc27e 100644 --- a/updater/action.yml +++ b/updater/action.yml @@ -29,6 +29,10 @@ inputs: description: 'How to handle PRs - can be either "create" (create new PRs for each version) or "update" (keep single PR updated with latest version)' required: false default: 'create' + target-branch: + description: 'Branch to use as base for dependency updates. Defaults to repository default branch if not specified.' + required: false + default: '' api-token: description: 'Token for the repo. Can be passed in using {{ secrets.GITHUB_TOKEN }}' required: true @@ -122,8 +126,13 @@ runs: env: PR_STRATEGY: ${{ inputs.pr-strategy }} DEPENDENCY_PATH: ${{ inputs.path }} + TARGET_BRANCH: ${{ inputs.target-branch }} run: | - $mainBranch = $(git remote show origin | Select-String "HEAD branch: (.*)").Matches[0].Groups[1].Value + if ([string]::IsNullOrEmpty($env:TARGET_BRANCH)) { + $mainBranch = $(git remote show origin | Select-String "HEAD branch: (.*)").Matches[0].Groups[1].Value + } else { + $mainBranch = $env:TARGET_BRANCH + } $prBranch = switch ($env:PR_STRATEGY) { 'create' { "deps/$env:DEPENDENCY_PATH/${{ steps.target.outputs.latestTag }}" } From d107930eda39ee9f18159472fe7bcd17881681b5 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 10:52:05 +0200 Subject: [PATCH 02/14] docs: clarify limitations for updating dependencies on non-default branches --- updater/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/updater/README.md b/updater/README.md index c3482b6b..e3ecf612 100644 --- a/updater/README.md +++ b/updater/README.md @@ -84,6 +84,7 @@ jobs: api-token: ${{ secrets.CI_DEPLOY_KEY }} # Update dependencies on a non-default branch (e.g., alpha, beta, or version branches) + # Note: due to limitations in GitHub Actions' schedule trigger, this code needs to be pushed to the default branch. cocoa-v7: runs-on: ubuntu-latest steps: @@ -155,4 +156,4 @@ If you're migrating from the v2 reusable workflow, see the [changelog migration Key changes: - Add `runs-on` to specify the runner - Move `secrets.api-token` to `with.api-token` -- No need for explicit `actions/checkout` step (handled internally) \ No newline at end of file +- No need for explicit `actions/checkout` step (handled internally) From 160c1c2c9479400eca97382fcfa1cb096dddb89e Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 10:52:54 +0200 Subject: [PATCH 03/14] docs: add changelog entry for target-branch feature --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01f9f752..7a74b62a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ To update your existing Danger workflows: ### Features +- Updater now supports targeting non-default branches via the new `target-branch` input parameter ([#118](https://github.com/getsentry/github-workflows/pull/118)) - Updater now supports filtering releases by GitHub release title patterns, e.g. to support release channels ([#117](https://github.com/getsentry/github-workflows/pull/117)) - Updater now supports dependencies without changelog files by falling back to git commit messages ([#116](https://github.com/getsentry/github-workflows/pull/116)) - Danger - Improve conventional commit scope handling, and non-conventional PR title support ([#105](https://github.com/getsentry/github-workflows/pull/105)) From 76284437ab7cea3ad11945ed835e73091d1c485f Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 11:02:36 +0200 Subject: [PATCH 04/14] fix: use existing branch for target-branch test The test was failing because 'test-branch' doesn't exist in this repository. Changed to use the existing 'test/nonbot-commits' branch instead. --- .github/workflows/workflow-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/workflow-tests.yml b/.github/workflows/workflow-tests.yml index 74ba8d1c..faa2abfa 100644 --- a/.github/workflows/workflow-tests.yml +++ b/.github/workflows/workflow-tests.yml @@ -86,7 +86,7 @@ jobs: path: updater/tests/sentry-cli.properties name: TARGET-BRANCH-TEST-DO-NOT-MERGE pattern: '^2\.0\.' - target-branch: test-branch + target-branch: test/nonbot-commits pr-strategy: update api-token: ${{ github.token }} @@ -106,8 +106,8 @@ jobs: echo "PR Branch: '$PR_BRANCH'" # Validate base branch is the specified target-branch - if [[ "$BASE_BRANCH" != "test-branch" ]]; then - echo "❌ Expected base branch 'test-branch', got '$BASE_BRANCH'" + if [[ "$BASE_BRANCH" != "test/nonbot-commits" ]]; then + echo "❌ Expected base branch 'test/nonbot-commits', got '$BASE_BRANCH'" exit 1 fi From 9ab4c4380b3eb4593d4be4cda211222443213399 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 13:17:48 +0200 Subject: [PATCH 05/14] fix: checkout target branch before making changes The previous implementation was creating PRs with the entire diff between the default branch and target branch. Now we properly checkout the target branch first, then make dependency updates on top of it. This ensures PRs only contain the dependency changes, not all differences between branches. --- updater/action.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/updater/action.yml b/updater/action.yml index 2f0cc27e..fe6be9f5 100644 --- a/updater/action.yml +++ b/updater/action.yml @@ -109,6 +109,13 @@ runs: with: token: ${{ inputs.api-token }} + - name: Checkout target branch + if: inputs.target-branch != '' + shell: bash + run: | + git fetch origin ${{ inputs.target-branch }}:${{ inputs.target-branch }} + git checkout ${{ inputs.target-branch }} + - name: Update to the latest version id: target shell: pwsh @@ -235,6 +242,13 @@ runs: with: token: ${{ inputs.api-token }} + - name: 'After new PR: checkout target branch' + if: ${{ inputs.target-branch != '' && ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }} + shell: bash + run: | + git fetch origin ${{ inputs.target-branch }}:${{ inputs.target-branch }} + git checkout ${{ inputs.target-branch }} + - name: 'After new PR: redo the update' if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }} shell: pwsh From 549bc0a8fe44a7db9c2d9b381fdd5d677400ddc5 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 13:21:05 +0200 Subject: [PATCH 06/14] refactor: use actions/checkout ref parameter instead of separate git commands Much cleaner approach using the built-in ref parameter of actions/checkout to directly checkout the target branch instead of manual git commands. Uses: ref: ${{ inputs.target-branch || github.ref }} - If target-branch is provided, checkout that branch - Otherwise, use the default behavior (github.ref) --- updater/action.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/updater/action.yml b/updater/action.yml index fe6be9f5..636940d8 100644 --- a/updater/action.yml +++ b/updater/action.yml @@ -108,13 +108,7 @@ runs: uses: actions/checkout@v4 with: token: ${{ inputs.api-token }} - - - name: Checkout target branch - if: inputs.target-branch != '' - shell: bash - run: | - git fetch origin ${{ inputs.target-branch }}:${{ inputs.target-branch }} - git checkout ${{ inputs.target-branch }} + ref: ${{ inputs.target-branch || github.ref }} - name: Update to the latest version id: target @@ -241,13 +235,7 @@ runs: uses: actions/checkout@v4 with: token: ${{ inputs.api-token }} - - - name: 'After new PR: checkout target branch' - if: ${{ inputs.target-branch != '' && ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }} - shell: bash - run: | - git fetch origin ${{ inputs.target-branch }}:${{ inputs.target-branch }} - git checkout ${{ inputs.target-branch }} + ref: ${{ inputs.target-branch || github.ref }} - name: 'After new PR: redo the update' if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }} From e4441818dc1b53e3f84dc8e18cdae8bab57c2ab5 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 14:54:57 +0200 Subject: [PATCH 07/14] refactor: update checkout paths in workflow tests and remove redundant checkout step in updater action --- .github/workflows/workflow-tests.yml | 12 +++++++++--- updater/action.yml | 5 ----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/workflow-tests.yml b/.github/workflows/workflow-tests.yml index faa2abfa..d9226043 100644 --- a/.github/workflows/workflow-tests.yml +++ b/.github/workflows/workflow-tests.yml @@ -15,10 +15,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + path: gh-workflow-tests-checkout - name: Run updater action id: updater - uses: ./updater + uses: gh-workflow-tests-checkout/updater with: path: updater/tests/sentry-cli.properties name: WORKFLOW-TEST-DEPENDENCY-DO-NOT-MERGE @@ -78,10 +80,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + path: gh-workflow-tests-checkout - name: Run updater action with target-branch id: updater - uses: ./updater + uses: gh-workflow-tests-checkout/updater with: path: updater/tests/sentry-cli.properties name: TARGET-BRANCH-TEST-DO-NOT-MERGE @@ -142,10 +146,12 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 + with: + path: gh-workflow-tests-checkout - name: Run updater action id: updater - uses: ./updater + uses: gh-workflow-tests-checkout/updater with: path: updater/tests/workflow-args.sh name: Workflow args test script diff --git a/updater/action.yml b/updater/action.yml index 636940d8..81a1e461 100644 --- a/updater/action.yml +++ b/updater/action.yml @@ -57,11 +57,6 @@ outputs: runs: using: 'composite' steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - token: ${{ inputs.api-token }} - - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # Tag: 0.12.1 with: From 0d65bdfe28a5da9f7ebe9efad46c4bf368a87233 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 14:59:24 +0200 Subject: [PATCH 08/14] fix: correct paths for checkout and updater action in workflow tests --- .github/workflows/workflow-tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/workflow-tests.yml b/.github/workflows/workflow-tests.yml index d9226043..ed49cb3f 100644 --- a/.github/workflows/workflow-tests.yml +++ b/.github/workflows/workflow-tests.yml @@ -16,11 +16,11 @@ jobs: steps: - uses: actions/checkout@v4 with: - path: gh-workflow-tests-checkout + path: ./gh-workflow-tests-checkout - name: Run updater action id: updater - uses: gh-workflow-tests-checkout/updater + uses: ./gh-workflow-tests-checkout/updater with: path: updater/tests/sentry-cli.properties name: WORKFLOW-TEST-DEPENDENCY-DO-NOT-MERGE @@ -81,11 +81,11 @@ jobs: steps: - uses: actions/checkout@v4 with: - path: gh-workflow-tests-checkout + path: ./gh-workflow-tests-checkout - name: Run updater action with target-branch id: updater - uses: gh-workflow-tests-checkout/updater + uses: ./gh-workflow-tests-checkout/updater with: path: updater/tests/sentry-cli.properties name: TARGET-BRANCH-TEST-DO-NOT-MERGE @@ -147,11 +147,11 @@ jobs: steps: - uses: actions/checkout@v4 with: - path: gh-workflow-tests-checkout + path: ./gh-workflow-tests-checkout - name: Run updater action id: updater - uses: gh-workflow-tests-checkout/updater + uses: ./gh-workflow-tests-checkout/updater with: path: updater/tests/workflow-args.sh name: Workflow args test script From f8b3e813f9dce48e81aa4de8e06cbd1dd55e4060 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 15:06:14 +0200 Subject: [PATCH 09/14] fix: set working directory to caller-repo for all relevant steps in the updater action --- updater/action.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/updater/action.yml b/updater/action.yml index 81a1e461..d8b34450 100644 --- a/updater/action.yml +++ b/updater/action.yml @@ -104,10 +104,12 @@ runs: with: token: ${{ inputs.api-token }} ref: ${{ inputs.target-branch || github.ref }} + path: caller-repo - name: Update to the latest version id: target shell: pwsh + working-directory: caller-repo env: DEPENDENCY_PATH: ${{ inputs.path }} DEPENDENCY_PATTERN: ${{ inputs.pattern }} @@ -119,6 +121,7 @@ runs: if: steps.target.outputs.latestTag != steps.target.outputs.originalTag id: root shell: pwsh + working-directory: caller-repo env: PR_STRATEGY: ${{ inputs.pr-strategy }} DEPENDENCY_PATH: ${{ inputs.path }} @@ -149,9 +152,10 @@ runs: - name: Parse the existing PR URL if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }} id: existing-pr + shell: pwsh + working-directory: caller-repo env: GH_TOKEN: ${{ inputs.api-token }} - shell: pwsh run: | $urls = @(gh api 'repos/${{ github.repository }}/pulls?base=${{ steps.root.outputs.baseBranch }}&head=${{ github.repository_owner }}:${{ steps.root.outputs.prBranch }}' --jq '.[].html_url') if ($urls.Length -eq 0) @@ -170,11 +174,13 @@ runs: - name: Show git diff if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }} shell: bash + working-directory: caller-repo run: git --no-pager diff - name: Get target changelog if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }} shell: pwsh + working-directory: caller-repo env: GH_TOKEN: ${{ inputs.api-token }} run: | @@ -189,6 +195,7 @@ runs: if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }} uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc # pin#v6.0.1 id: create-pr + working-directory: caller-repo env: DEPENDENCY_PATH: ${{ inputs.path }} DEPENDENCY_NAME: ${{ inputs.name }} @@ -209,6 +216,7 @@ runs: if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }} id: pr shell: pwsh + working-directory: caller-repo run: | if ('${{ steps.create-pr.outputs.pull-request-url }}' -ne '') { @@ -231,10 +239,12 @@ runs: with: token: ${{ inputs.api-token }} ref: ${{ inputs.target-branch || github.ref }} + path: caller-repo - name: 'After new PR: redo the update' if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }} shell: pwsh + working-directory: caller-repo env: DEPENDENCY_PATH: ${{ inputs.path }} GH_TOKEN: ${{ inputs.api-token }} @@ -243,6 +253,7 @@ runs: - name: Update Changelog if: ${{ inputs.changelog-entry && ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }} shell: pwsh + working-directory: caller-repo env: DEPENDENCY_NAME: ${{ inputs.name }} CHANGELOG_SECTION: ${{ inputs.changelog-section }} @@ -260,6 +271,7 @@ runs: - name: Show final git diff if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }} shell: bash + working-directory: caller-repo run: git --no-pager diff # Now make the PR in its final state. This way we only have one commit and no updates if there are no changes between runs. @@ -267,6 +279,7 @@ runs: if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }} uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc # pin#v6.0.1 id: update + working-directory: caller-repo env: DEPENDENCY_PATH: ${{ inputs.path }} DEPENDENCY_NAME: ${{ inputs.name }} From 0fc6d11f58acadb5eff59b032c9deb82e38e9229 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 15:06:51 +0200 Subject: [PATCH 10/14] roll back workflow-test changes --- .github/workflows/workflow-tests.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/workflow-tests.yml b/.github/workflows/workflow-tests.yml index ed49cb3f..faa2abfa 100644 --- a/.github/workflows/workflow-tests.yml +++ b/.github/workflows/workflow-tests.yml @@ -15,12 +15,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - path: ./gh-workflow-tests-checkout - name: Run updater action id: updater - uses: ./gh-workflow-tests-checkout/updater + uses: ./updater with: path: updater/tests/sentry-cli.properties name: WORKFLOW-TEST-DEPENDENCY-DO-NOT-MERGE @@ -80,12 +78,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - path: ./gh-workflow-tests-checkout - name: Run updater action with target-branch id: updater - uses: ./gh-workflow-tests-checkout/updater + uses: ./updater with: path: updater/tests/sentry-cli.properties name: TARGET-BRANCH-TEST-DO-NOT-MERGE @@ -146,12 +142,10 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - with: - path: ./gh-workflow-tests-checkout - name: Run updater action id: updater - uses: ./gh-workflow-tests-checkout/updater + uses: ./updater with: path: updater/tests/workflow-args.sh name: Workflow args test script From b89993d4afeb4c51082328d438919ee2755172c8 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 15:15:53 +0200 Subject: [PATCH 11/14] fix: update working directory path for create-pull-request action --- updater/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/updater/action.yml b/updater/action.yml index d8b34450..9ee9422f 100644 --- a/updater/action.yml +++ b/updater/action.yml @@ -195,11 +195,11 @@ runs: if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }} uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc # pin#v6.0.1 id: create-pr - working-directory: caller-repo env: DEPENDENCY_PATH: ${{ inputs.path }} DEPENDENCY_NAME: ${{ inputs.name }} with: + path: caller-repo base: ${{ steps.root.outputs.baseBranch }} branch: ${{ steps.root.outputs.prBranch }} commit-message: 'chore: update ${{ env.DEPENDENCY_PATH }} to ${{ steps.target.outputs.latestTag }}' @@ -279,11 +279,11 @@ runs: if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }} uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc # pin#v6.0.1 id: update - working-directory: caller-repo env: DEPENDENCY_PATH: ${{ inputs.path }} DEPENDENCY_NAME: ${{ inputs.name }} with: + path: caller-repo base: ${{ steps.root.outputs.baseBranch }} branch: ${{ steps.root.outputs.prBranch }} commit-message: 'chore: update ${{ env.DEPENDENCY_PATH }} to ${{ steps.target.outputs.latestTag }}' From bfaba841fb1c2f04932c594ba483638dc7d59e56 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 15:33:28 +0200 Subject: [PATCH 12/14] fix: prepend main branch name to PR branch for better organization --- updater/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/updater/action.yml b/updater/action.yml index 9ee9422f..ab411588 100644 --- a/updater/action.yml +++ b/updater/action.yml @@ -129,10 +129,12 @@ runs: run: | if ([string]::IsNullOrEmpty($env:TARGET_BRANCH)) { $mainBranch = $(git remote show origin | Select-String "HEAD branch: (.*)").Matches[0].Groups[1].Value + $prBranchPrefix = '' } else { $mainBranch = $env:TARGET_BRANCH + $prBranchPrefix = "$mainBranch-" } - $prBranch = switch ($env:PR_STRATEGY) + $prBranch = $prBranchPrefix + switch ($env:PR_STRATEGY) { 'create' { "deps/$env:DEPENDENCY_PATH/${{ steps.target.outputs.latestTag }}" } 'update' { "deps/$env:DEPENDENCY_PATH" } From 9e6791b0bb5f9b9441a53612befc94ad3c043bae Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 15:45:28 +0200 Subject: [PATCH 13/14] fix: prepend PR branch prefix to generated branch name based on strategy --- updater/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/updater/action.yml b/updater/action.yml index ab411588..1f951066 100644 --- a/updater/action.yml +++ b/updater/action.yml @@ -134,12 +134,13 @@ runs: $mainBranch = $env:TARGET_BRANCH $prBranchPrefix = "$mainBranch-" } - $prBranch = $prBranchPrefix + switch ($env:PR_STRATEGY) + $prBranch = switch ($env:PR_STRATEGY) { 'create' { "deps/$env:DEPENDENCY_PATH/${{ steps.target.outputs.latestTag }}" } 'update' { "deps/$env:DEPENDENCY_PATH" } default { throw "Unkown PR strategy '$env:PR_STRATEGY'." } } + $prBranch = $prBranchPrefix + $prBranch "baseBranch=$mainBranch" | Tee-Object $env:GITHUB_OUTPUT -Append "prBranch=$prBranch" | Tee-Object $env:GITHUB_OUTPUT -Append $nonBotCommits = ${{ github.action_path }}/scripts/nonbot-commits.ps1 ` From 0d5df093a16006d8f1344759f7288e3986d65942 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 24 Sep 2025 15:50:43 +0200 Subject: [PATCH 14/14] fix: update expected PR branch format in validation step --- .github/workflows/workflow-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow-tests.yml b/.github/workflows/workflow-tests.yml index faa2abfa..d4657c71 100644 --- a/.github/workflows/workflow-tests.yml +++ b/.github/workflows/workflow-tests.yml @@ -130,8 +130,8 @@ jobs: 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'" + 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