From 90e3cd3c48580a81eba2ab825e715646a3883a05 Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Sun, 16 Nov 2025 17:58:30 +0100 Subject: [PATCH 1/2] fix(develop-update): remove auto-merge option and update README for workflow behavior --- .github/workflows/develop-update.yml | 56 ---------------------------- README.md | 6 +-- 2 files changed, 3 insertions(+), 59 deletions(-) diff --git a/.github/workflows/develop-update.yml b/.github/workflows/develop-update.yml index db64072..0840da6 100644 --- a/.github/workflows/develop-update.yml +++ b/.github/workflows/develop-update.yml @@ -11,11 +11,6 @@ on: 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 @@ -135,54 +130,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_DESCRIPTION: ${{ inputs.pr_description }} - - # Auto merge handling - - name: "Check if latest commit was a merge commit from develop" - if: steps.create_pr.outputs.URL != '' && inputs.auto_merge != 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' - 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_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." - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: "Auto-merge Pull Request" - if: (steps.check_merge_source.outputs.latest_from_develop == 'true' || steps.check_merge_source.outputs.latest_from_develop == 'not_merge') && inputs.auto_merge != false - 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 --auto - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 47a71c2..bc444f8 100644 --- a/README.md +++ b/README.md @@ -174,9 +174,10 @@ 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. +- **Normal develop flow**: When the latest commit on `main` was merged from a `develop` PR. + - Create a PR from `main` to `develop` with the changes. - **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 + - Create a PR from `main` to `develop` with the changes. - Add a comment to the PR explaining the situation - Create a workflow warning for visibility @@ -187,7 +188,6 @@ If no commits are found in `main` that aren't in `develop`, or an existing PR be #### 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. 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 7c4a95d5b8a753542798af413a3a9dde5c3487c0 Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Sun, 16 Nov 2025 18:02:38 +0100 Subject: [PATCH 2/2] Remove detailed merge scenario explanations from README --- README.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/README.md b/README.md index bc444f8..f6afeb2 100644 --- a/README.md +++ b/README.md @@ -172,17 +172,6 @@ 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. - - Create a PR from `main` to `develop` with the changes. -- **Hotfix detection**: When the latest commit on `main` was merged from a different branch (e.g., a hotfix), the workflow will: - - Create a PR from `main` to `develop` with the changes. - - 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 no commits are found in `main` that aren't in `develop`, or an existing PR between main and develop exists, the workflow will exit without merging changes, but will create a PR if possible. #### Inputs