From 62f4e463758abbd2031e7b79d9c486d7808094fc Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Sun, 16 Nov 2025 10:59:18 +0100 Subject: [PATCH 01/10] feat(develop-update): add workflow to update develop branch from main --- .github/workflows/develop-update.yml | 128 +++++++++++++++++++++++++++ README.md | 31 +++++++ 2 files changed, 159 insertions(+) create mode 100644 .github/workflows/develop-update.yml diff --git a/.github/workflows/develop-update.yml b/.github/workflows/develop-update.yml new file mode 100644 index 0000000..6b03186 --- /dev/null +++ b/.github/workflows/develop-update.yml @@ -0,0 +1,128 @@ +# This workflow opens a PR between main and develop branches to keep develop up to date. +name: "Update Develop Branch" + +on: + push: + branches: + - main + workflow_call: + inputs: + repository: + description: "Allowed repository for workflow to run in. Example `ctfpilot/hello-world`." + required: true + type: string + auto_merge: + description: "Whether to automatically merge the PR after creating it." + required: false + type: boolean + default: true + pr_description: + description: "Additional description to add to the PR body." + required: false + type: string + +jobs: + update-develop: + name: "Update Develop Branch" + runs-on: ubuntu-latest + if: github.repository == ( inputs.repository || 'ctfpilot/ci') && github.ref == 'refs/heads/main' + steps: + - name: "Checkout" + uses: actions/checkout@v4 + with: + repository: ${{ inputs.repository }} + ref: main + - name: "Check if there is a diff between main and develop" + id: check_diff + run: | + git fetch origin develop + DIFF=$(git diff origin/develop..main) + if [ -z "$DIFF" ]; then + echo "No differences found between main and develop." + echo "diff=false" >> $GITHUB_OUTPUT + else + echo "Differences found between main and develop." + echo "diff=true" >> $GITHUB_OUTPUT + fi + - name: "Check if existing PR exists" + if: steps.check_diff.outputs.diff == 'true' + id: check_pr + uses: actions/github-script@v6 + with: + script: | + const { data: pullRequests } = await github.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + head: `${context.repo.owner}:develop`, + base: 'main', + state: 'open' + }); + if (pullRequests.length > 0) { + return 'true'; + } else { + return 'false'; + } + result-encoding: string + - name: "Ensure \"develop-update\" label is created" + if: steps.check_diff.outputs.diff == 'true' && steps.check_pr.outputs.result == 'false' + uses: actions/github-script@v6 + with: + script: | + try { + await github.issues.getLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: 'develop-update' + }); + } catch (error) { + if (error.status === 404) { + await github.issues.createLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: 'develop-update', + color: '0E8A16', + description: 'Indicates that this PR updates the develop branch to match the latest version of main.' + }); + } else { + throw error; + } + } + - name: "Ensure \"ci\" label is created" + if: steps.check_diff.outputs.diff == 'true' && steps.check_pr.outputs.result == 'false' + uses: actions/github-script@v6 + with: + script: | + try { + await github.issues.getLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: 'ci' + }); + } catch (error) { + if (error.status === 404) { + await github.issues.createLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: 'ci', + color: 'EDEDED', + description: 'Indicates that this PR is related to continuous integration.' + }); + } else { + throw error; + } + } + - name: "Create Pull Request to update develop branch, and merge it" + id: create_pr + if: steps.check_diff.outputs.diff == 'true' && steps.check_pr.outputs.result == 'false' + run: >- + URL=$(gh pr create -B develop -H main --title 'CI: Update develop to match main' --body 'Merge main into develop to update the develop branch to the latest version\n\n${{ inputs.pr_description || '' }}' --label develop-update --label ci) + echo "URL=$URL" >> $GITHUB_OUTPUT + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: "Auto-merge Pull Request" + if: steps.create_pr.outputs.URL != '' && inputs.auto_merge == true + run: | + gh pr merge "${{ steps.create_pr.outputs.URL }}" -t "chore(ci): Auto update develop to match main [skip ci]" -b "This was done automatically by the CI pipeline" --merge + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + \ No newline at end of file diff --git a/README.md b/README.md index 9f8cac2..21c413e 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ jobs: - [`cla-assistant`](#cla-assistant): CLA Assistant bot - [`release`](#release): Release system - [`docker`](#docker): Docker build and push system +- [`develop-update`](./develop-update/README.md): Update develop branch to match main branch ### CLA Assistant @@ -165,6 +166,36 @@ jobs: repository: ``` +### Develop Update + +This workflow updates the `develop` branch to match the latest version of the `main` branch. + +The workflow requires the `repository` input to be specified. + +#### Inputs + +- `repository`: Allowed repository for workflow to run in. Example `ctfpilot/hello-world`. +- `auto_merge`: Whether to automatically merge the PR after creating it. Defaults to true. +- `pr_description`: Additional description to add to the PR body. + +#### How to use + +```yml +name: "Update Develop Branch" + +on: + push: + branches: + - main + +jobs: + CLAAssistant: + name: "Update Develop Branch" + uses: ctfpilot/ci/.github/workflows/develop-update.yml@ + with: + repository: +``` + ## Contributing We welcome contributions of all kinds, from **code** and **documentation** to **bug reports** and **feedback**! From 886ccfddc5c55b8d7f373a325bd2fbc31ed6eacc Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Sun, 16 Nov 2025 11:01:20 +0100 Subject: [PATCH 02/10] Add permissions to develop-update workflow and README --- .github/workflows/develop-update.yml | 5 +++++ README.md | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/.github/workflows/develop-update.yml b/.github/workflows/develop-update.yml index 6b03186..084392b 100644 --- a/.github/workflows/develop-update.yml +++ b/.github/workflows/develop-update.yml @@ -21,6 +21,11 @@ on: required: false type: string +permissions: + contents: read + pull-requests: write + issues: write + jobs: update-develop: name: "Update Develop Branch" diff --git a/README.md b/README.md index 21c413e..d9a8f47 100644 --- a/README.md +++ b/README.md @@ -190,6 +190,10 @@ on: jobs: CLAAssistant: + permissions: + contents: read + pull-requests: write + issues: write name: "Update Develop Branch" uses: ctfpilot/ci/.github/workflows/develop-update.yml@ with: From ff7f698a656ebc703e56b1aed8bfd19d4e4ae6db Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Sun, 16 Nov 2025 11:12:40 +0100 Subject: [PATCH 03/10] feat(develop-update): enhance auto-merge logic and add warnings for non-develop merges --- .github/workflows/develop-update.yml | 75 ++++++++++++++++++++++++++-- README.md | 14 +++++- 2 files changed, 83 insertions(+), 6 deletions(-) diff --git a/.github/workflows/develop-update.yml b/.github/workflows/develop-update.yml index 084392b..a424023 100644 --- a/.github/workflows/develop-update.yml +++ b/.github/workflows/develop-update.yml @@ -68,7 +68,7 @@ jobs: return 'false'; } result-encoding: string - - name: "Ensure \"develop-update\" label is created" + - name: 'Ensure "develop-update" label is created' if: steps.check_diff.outputs.diff == 'true' && steps.check_pr.outputs.result == 'false' uses: actions/github-script@v6 with: @@ -92,7 +92,7 @@ jobs: throw error; } } - - name: "Ensure \"ci\" label is created" + - name: 'Ensure "ci" label is created' if: steps.check_diff.outputs.diff == 'true' && steps.check_pr.outputs.result == 'false' uses: actions/github-script@v6 with: @@ -124,10 +124,75 @@ jobs: echo "URL=$URL" >> $GITHUB_OUTPUT env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: "Check if latest commit was a merge commit from develop" + if: steps.check_diff.outputs.diff == 'true' && steps.check_pr.outputs.result == 'false' + id: check_merge_source + run: | + # Check if latest commit is a merge commit + if git rev-parse --verify HEAD^2 &>/dev/null; then + echo "Latest commit is a merge commit" + # Get PR number from merge commit message + PR_NUMBER=$(git log -1 --pretty=%B | grep -oP 'Merge pull request #\K[0-9]+' || echo "") + if [ -n "$PR_NUMBER" ]; then + echo "Found PR number: $PR_NUMBER" + # Use gh CLI to check PR head branch + HEAD_BRANCH=$(gh pr view "$PR_NUMBER" --json headRefName -q .headRefName || echo "") + echo "PR head branch: $HEAD_BRANCH" + if [ "$HEAD_BRANCH" = "develop" ]; then + echo "latest_from_develop=true" >> $GITHUB_OUTPUT + echo "✓ Latest commit merged from develop branch PR" + else + echo "latest_from_develop=false" >> $GITHUB_OUTPUT + echo "head_branch=$HEAD_BRANCH" >> $GITHUB_OUTPUT + echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT + echo "⚠ Latest commit merged from '$HEAD_BRANCH' branch (not develop)" + fi + else + echo "latest_from_develop=unknown" >> $GITHUB_OUTPUT + echo "Could not determine PR number from merge commit" + fi + else + echo "latest_from_develop=not_merge" >> $GITHUB_OUTPUT + echo "Latest commit is not a merge commit" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: "Create warning for non-develop merge" + if: steps.check_merge_source.outputs.latest_from_develop == 'false' && inputs.auto_merge == true + run: | + echo "::warning::Latest merge commit on main was from branch '${{ steps.check_merge_source.outputs.head_branch }}' (PR #${{ steps.check_merge_source.outputs.pr_number }}), not from develop. Auto-merge will be skipped to allow manual review." + - name: "Comment on PR about skipped auto-merge" + if: steps.check_pr.outputs.result == 'true' && steps.check_merge_source.outputs.latest_from_develop == 'false' && inputs.auto_merge == true + uses: actions/github-script@v6 + with: + script: | + const { data: pullRequests } = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + head: `${context.repo.owner}:develop`, + base: 'main', + state: 'open' + }); + if (pullRequests.length > 0) { + const prNumber = pullRequests[0].number; + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: `⚠️ **Auto-merge skipped**\n\nThe latest commit on \`main\` was merged from branch \`${{ steps.check_merge_source.outputs.head_branch }}\` (PR #${{ steps.check_merge_source.outputs.pr_number }}), not from \`develop\`.\n\nThis suggests a hotfix or other direct merge to \`main\` occurred. Please review the changes manually before merging this PR to ensure \`develop\` is properly synchronized.` + }); + } - name: "Auto-merge Pull Request" - if: steps.create_pr.outputs.URL != '' && inputs.auto_merge == true + if: (steps.create_pr.outputs.URL != '' || (steps.check_pr.outputs.result == 'true' && steps.check_merge_source.outputs.latest_from_develop == 'true')) && inputs.auto_merge == true run: | - gh pr merge "${{ steps.create_pr.outputs.URL }}" -t "chore(ci): Auto update develop to match main [skip ci]" -b "This was done automatically by the CI pipeline" --merge + if [ -n "${{ steps.create_pr.outputs.URL }}" ]; then + PR_URL="${{ steps.create_pr.outputs.URL }}" + else + # Get existing PR URL + PR_URL=$(gh pr list --head develop --base main --state open --json url --jq '.[0].url') + fi + if [ -n "$PR_URL" ]; then + gh pr merge "$PR_URL" -t "chore(ci): Auto update develop to match main [skip ci]" -b "This was done automatically by the CI pipeline" --merge + fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - \ No newline at end of file diff --git a/README.md b/README.md index d9a8f47..236a712 100644 --- a/README.md +++ b/README.md @@ -172,10 +172,22 @@ This workflow updates the `develop` branch to match the latest version of the `m The workflow requires the `repository` input to be specified. +The workflow intelligently handles different merge scenarios: + +- **Normal develop flow**: When the latest commit on `main` was merged from a `develop` PR, the workflow will auto-merge (if enabled) to keep develop synchronized. +- **Hotfix detection**: When the latest commit on `main` was merged from a different branch (e.g., a hotfix), the workflow will: + - Skip auto-merge to allow manual review + - Add a comment to the PR explaining the situation + - Create a workflow warning for visibility + +This ensures that hotfixes and other direct merges to `main` are properly reviewed before being merged back to `develop`. + +If a merge is not detected, the main and develop branches are already in sync or an existing PR between main and develop exists, the workflow will exit without making any changes. + #### Inputs - `repository`: Allowed repository for workflow to run in. Example `ctfpilot/hello-world`. -- `auto_merge`: Whether to automatically merge the PR after creating it. Defaults to true. +- `auto_merge`: Whether to automatically merge the PR after creating it. Defaults to true. Note: Auto-merge will be skipped if the latest commit on `main` was not from a `develop` branch PR. - `pr_description`: Additional description to add to the PR body. #### How to use From e7bb5de5649e4f65ccc8e4587cca0e87966640df Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Sun, 16 Nov 2025 11:14:36 +0100 Subject: [PATCH 04/10] Enhance clarity for develop update exit handling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 236a712..fe1283f 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,7 @@ The workflow intelligently handles different merge scenarios: This ensures that hotfixes and other direct merges to `main` are properly reviewed before being merged back to `develop`. -If a merge is not detected, the main and develop branches are already in sync or an existing PR between main and develop exists, the workflow will exit without making any changes. +If a merge is not detected, the main and develop branches are already in sync or an existing PR between main and develop exists, the workflow will exit without merging changes, but will create a PR if possible. #### Inputs From 6f0a371917487e6980d7d8781cd5a324753a6bd7 Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Sun, 16 Nov 2025 11:20:08 +0100 Subject: [PATCH 05/10] Correct pull request base and head references in workflow --- .github/workflows/develop-update.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/develop-update.yml b/.github/workflows/develop-update.yml index a424023..b14faaa 100644 --- a/.github/workflows/develop-update.yml +++ b/.github/workflows/develop-update.yml @@ -58,8 +58,8 @@ jobs: const { data: pullRequests } = await github.pulls.list({ owner: context.repo.owner, repo: context.repo.repo, - head: `${context.repo.owner}:develop`, - base: 'main', + head: `main`, + base: '${context.repo.owner}:develop', state: 'open' }); if (pullRequests.length > 0) { @@ -169,8 +169,8 @@ jobs: const { data: pullRequests } = await github.rest.pulls.list({ owner: context.repo.owner, repo: context.repo.repo, - head: `${context.repo.owner}:develop`, - base: 'main', + head: ``, + base: '${context.repo.owner}:developmain', state: 'open' }); if (pullRequests.length > 0) { From 52fbbebaf512a946d145441fd3c34afc93490fd1 Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Sun, 16 Nov 2025 11:20:24 +0100 Subject: [PATCH 06/10] Correct multiple logic errors in develop-update --- .github/workflows/develop-update.yml | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/workflows/develop-update.yml b/.github/workflows/develop-update.yml index b14faaa..c6d39c2 100644 --- a/.github/workflows/develop-update.yml +++ b/.github/workflows/develop-update.yml @@ -35,7 +35,6 @@ jobs: - name: "Checkout" uses: actions/checkout@v4 with: - repository: ${{ inputs.repository }} ref: main - name: "Check if there is a diff between main and develop" id: check_diff @@ -162,28 +161,13 @@ jobs: run: | echo "::warning::Latest merge commit on main was from branch '${{ steps.check_merge_source.outputs.head_branch }}' (PR #${{ steps.check_merge_source.outputs.pr_number }}), not from develop. Auto-merge will be skipped to allow manual review." - name: "Comment on PR about skipped auto-merge" - if: steps.check_pr.outputs.result == 'true' && steps.check_merge_source.outputs.latest_from_develop == 'false' && inputs.auto_merge == true + if: steps.create_pr.outputs.URL != '' && steps.check_pr.outputs.result == 'false' && steps.check_merge_source.outputs.latest_from_develop == 'false' && inputs.auto_merge == true uses: actions/github-script@v6 with: script: | - const { data: pullRequests } = await github.rest.pulls.list({ - owner: context.repo.owner, - repo: context.repo.repo, - head: ``, - base: '${context.repo.owner}:developmain', - state: 'open' - }); - if (pullRequests.length > 0) { - const prNumber = pullRequests[0].number; - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: prNumber, - body: `⚠️ **Auto-merge skipped**\n\nThe latest commit on \`main\` was merged from branch \`${{ steps.check_merge_source.outputs.head_branch }}\` (PR #${{ steps.check_merge_source.outputs.pr_number }}), not from \`develop\`.\n\nThis suggests a hotfix or other direct merge to \`main\` occurred. Please review the changes manually before merging this PR to ensure \`develop\` is properly synchronized.` - }); - } + gh PR comment ${{ steps.create_pr.outputs.URL }} "⚠️ Auto-merge skipped: Latest merge commit on main was from branch '${{ steps.check_merge_source.outputs.head_branch }}' (PR #${{ steps.check_merge_source.outputs.pr_number }}), not from develop. Please review and merge manually." - name: "Auto-merge Pull Request" - if: (steps.create_pr.outputs.URL != '' || (steps.check_pr.outputs.result == 'true' && steps.check_merge_source.outputs.latest_from_develop == 'true')) && inputs.auto_merge == true + if: (steps.create_pr.outputs.URL != '' || (steps.check_pr.outputs.result == 'false' && steps.check_merge_source.outputs.latest_from_develop == 'true')) && inputs.auto_merge == true run: | if [ -n "${{ steps.create_pr.outputs.URL }}" ]; then PR_URL="${{ steps.create_pr.outputs.URL }}" From 39d115aafdaf8bef3e10b9047ef21be1f4b2b6de Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Sun, 16 Nov 2025 11:27:35 +0100 Subject: [PATCH 07/10] Update formatting and documentation for develop-update --- .github/workflows/develop-update.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/develop-update.yml b/.github/workflows/develop-update.yml index c6d39c2..db06e30 100644 --- a/.github/workflows/develop-update.yml +++ b/.github/workflows/develop-update.yml @@ -36,6 +36,8 @@ jobs: uses: actions/checkout@v4 with: ref: main + + # Ensure diff between main and develop - name: "Check if there is a diff between main and develop" id: check_diff run: | @@ -67,8 +69,10 @@ jobs: return 'false'; } result-encoding: string + + # Ensure labels exist - name: 'Ensure "develop-update" label is created' - if: steps.check_diff.outputs.diff == 'true' && steps.check_pr.outputs.result == 'false' + if: steps.check_pr.outputs.result == 'false' uses: actions/github-script@v6 with: script: | @@ -92,7 +96,7 @@ jobs: } } - name: 'Ensure "ci" label is created' - if: steps.check_diff.outputs.diff == 'true' && steps.check_pr.outputs.result == 'false' + if: steps.check_pr.outputs.result == 'false' uses: actions/github-script@v6 with: script: | @@ -115,6 +119,8 @@ jobs: throw error; } } + + # PR Creation - name: "Create Pull Request to update develop branch, and merge it" id: create_pr if: steps.check_diff.outputs.diff == 'true' && steps.check_pr.outputs.result == 'false' @@ -123,8 +129,10 @@ jobs: echo "URL=$URL" >> $GITHUB_OUTPUT env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Auto merge handling - name: "Check if latest commit was a merge commit from develop" - if: steps.check_diff.outputs.diff == 'true' && steps.check_pr.outputs.result == 'false' + if: steps.create_pr.outputs.URL != '' && inputs.auto_merge == true id: check_merge_source run: | # Check if latest commit is a merge commit @@ -157,17 +165,15 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: "Create warning for non-develop merge" - if: steps.check_merge_source.outputs.latest_from_develop == 'false' && inputs.auto_merge == true + if: steps.check_merge_source.outputs.latest_from_develop == 'false' run: | echo "::warning::Latest merge commit on main was from branch '${{ steps.check_merge_source.outputs.head_branch }}' (PR #${{ steps.check_merge_source.outputs.pr_number }}), not from develop. Auto-merge will be skipped to allow manual review." - name: "Comment on PR about skipped auto-merge" - if: steps.create_pr.outputs.URL != '' && steps.check_pr.outputs.result == 'false' && steps.check_merge_source.outputs.latest_from_develop == 'false' && inputs.auto_merge == true - uses: actions/github-script@v6 - with: - script: | - gh PR comment ${{ steps.create_pr.outputs.URL }} "⚠️ Auto-merge skipped: Latest merge commit on main was from branch '${{ steps.check_merge_source.outputs.head_branch }}' (PR #${{ steps.check_merge_source.outputs.pr_number }}), not from develop. Please review and merge manually." + if: steps.check_merge_source.outputs.latest_from_develop == 'false' + run: | + gh PR comment ${{ steps.create_pr.outputs.URL }} "⚠️ Auto-merge skipped: Latest merge commit on main was from branch '${{ steps.check_merge_source.outputs.head_branch }}' (PR #${{ steps.check_merge_source.outputs.pr_number }}), not from develop. Please review and merge manually." - name: "Auto-merge Pull Request" - if: (steps.create_pr.outputs.URL != '' || (steps.check_pr.outputs.result == 'false' && steps.check_merge_source.outputs.latest_from_develop == 'true')) && inputs.auto_merge == true + if: steps.check_merge_source.outputs.latest_from_develop == 'true' run: | if [ -n "${{ steps.create_pr.outputs.URL }}" ]; then PR_URL="${{ steps.create_pr.outputs.URL }}" From aeb986bbfaaa5ef3485b6b8d1a9570c6ba7b59f9 Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Sun, 16 Nov 2025 11:28:47 +0100 Subject: [PATCH 08/10] Simplify auto-merge for develop-update --- .github/workflows/develop-update.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/develop-update.yml b/.github/workflows/develop-update.yml index db06e30..039d76e 100644 --- a/.github/workflows/develop-update.yml +++ b/.github/workflows/develop-update.yml @@ -175,14 +175,6 @@ jobs: - name: "Auto-merge Pull Request" if: steps.check_merge_source.outputs.latest_from_develop == 'true' run: | - if [ -n "${{ steps.create_pr.outputs.URL }}" ]; then - PR_URL="${{ steps.create_pr.outputs.URL }}" - else - # Get existing PR URL - PR_URL=$(gh pr list --head develop --base main --state open --json url --jq '.[0].url') - fi - if [ -n "$PR_URL" ]; then - gh pr merge "$PR_URL" -t "chore(ci): Auto update develop to match main [skip ci]" -b "This was done automatically by the CI pipeline" --merge - fi + gh pr merge "${{ steps.create_pr.outputs.URL }}" -t "chore(ci): Auto update develop to match main [skip ci]" -b "This was done automatically by the CI pipeline" --merge env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 61081ff796ee7a4afeb24d036b05ef578a566543 Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Sun, 16 Nov 2025 11:32:31 +0100 Subject: [PATCH 09/10] Fix minor issues and fomatting in develop-update --- .github/workflows/develop-update.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/develop-update.yml b/.github/workflows/develop-update.yml index 039d76e..b24c53e 100644 --- a/.github/workflows/develop-update.yml +++ b/.github/workflows/develop-update.yml @@ -59,8 +59,8 @@ jobs: const { data: pullRequests } = await github.pulls.list({ owner: context.repo.owner, repo: context.repo.repo, - head: `main`, - base: '${context.repo.owner}:develop', + head: 'main', + base: 'develop', state: 'open' }); if (pullRequests.length > 0) { @@ -124,7 +124,7 @@ jobs: - name: "Create Pull Request to update develop branch, and merge it" id: create_pr if: steps.check_diff.outputs.diff == 'true' && steps.check_pr.outputs.result == 'false' - run: >- + run: | URL=$(gh pr create -B develop -H main --title 'CI: Update develop to match main' --body 'Merge main into develop to update the develop branch to the latest version\n\n${{ inputs.pr_description || '' }}' --label develop-update --label ci) echo "URL=$URL" >> $GITHUB_OUTPUT env: @@ -171,7 +171,9 @@ jobs: - name: "Comment on PR about skipped auto-merge" if: steps.check_merge_source.outputs.latest_from_develop == 'false' run: | - gh PR comment ${{ steps.create_pr.outputs.URL }} "⚠️ Auto-merge skipped: Latest merge commit on main was from branch '${{ steps.check_merge_source.outputs.head_branch }}' (PR #${{ steps.check_merge_source.outputs.pr_number }}), not from develop. Please review and merge manually." + gh pr comment ${{ steps.create_pr.outputs.URL }} "⚠️ Auto-merge skipped: Latest merge commit on main was from branch '${{ steps.check_merge_source.outputs.head_branch }}' (PR #${{ steps.check_merge_source.outputs.pr_number }}), not from develop. Please review and merge manually." + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: "Auto-merge Pull Request" if: steps.check_merge_source.outputs.latest_from_develop == 'true' run: | From e3373a9d95b13ea10f950c7594fd66cf94b901be Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Sun, 16 Nov 2025 11:34:54 +0100 Subject: [PATCH 10/10] Correct docs link to develop-update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fe1283f..d086806 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ jobs: - [`cla-assistant`](#cla-assistant): CLA Assistant bot - [`release`](#release): Release system - [`docker`](#docker): Docker build and push system -- [`develop-update`](./develop-update/README.md): Update develop branch to match main branch +- [`develop-update`](#develop-update): Update develop branch to match main branch ### CLA Assistant