diff --git a/.github/workflows/edit-dependabot-pr.yml b/.github/workflows/edit-dependabot-pr.yml deleted file mode 100644 index a273c61d5e..0000000000 --- a/.github/workflows/edit-dependabot-pr.yml +++ /dev/null @@ -1,55 +0,0 @@ -# This workflow is an adaptation from https://github.com/spring-projects/spring-integration/blob/main/.github/workflows/merge-dependabot-pr.yml -# and https://github.com/spring-io/spring-github-workflows/blob/main/.github/workflows/spring-merge-dependabot-pr.yml - -name: Edit Dependabot PR - -on: - pull_request: - -run-name: Edit Dependabot PR ${{ github.ref_name }} - -env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -jobs: - edit-dependabot-pr: - runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' - permissions: write-all - steps: - - - uses: actions/checkout@v4 - with: - show-progress: false - - - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 17 - - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@v1 - with: - github-token: ${{ env.GH_TOKEN }} - - - name: Set Milestone to Dependabot pull request - id: set-milestone - run: | - if test -f pom.xml - then - CURRENT_VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout) - else - CURRENT_VERSION=$(cat gradle.properties | sed -n '/^version=/ { s/^version=//;p }') - fi - export CANDIDATE_VERSION=${CURRENT_VERSION/-SNAPSHOT} - MILESTONE=$(gh api repos/$GITHUB_REPOSITORY/milestones --jq 'map(select(.due_on != null and (.title | startswith(env.CANDIDATE_VERSION)))) | .[0] | .title') - - if [ -z $MILESTONE ] - then - gh run cancel ${{ github.run_id }} - echo "::warning title=Cannot merge::No scheduled milestone for $CURRENT_VERSION version" - else - gh pr edit ${{ github.event.pull_request.number }} --milestone $MILESTONE - echo mergeEnabled=true >> $GITHUB_OUTPUT - fi diff --git a/.github/workflows/merge-dependabot-pr.yml b/.github/workflows/merge-dependabot-pr.yml new file mode 100644 index 0000000000..5f2879e372 --- /dev/null +++ b/.github/workflows/merge-dependabot-pr.yml @@ -0,0 +1,13 @@ +name: Merge Dependabot PR + +on: + pull_request: + +run-name: Merge Dependabot PR ${{ github.ref_name }} + +jobs: + merge-dependabot-pr: + permissions: write-all + uses: spring-io/spring-github-workflows/.github/workflows/spring-merge-dependabot-pr.yml@v2 + with: + mergeArguments: '--auto --rebase' diff --git a/.github/workflows/trigger-dependabot-auto-merge-forward.yml b/.github/workflows/trigger-dependabot-auto-merge-forward.yml new file mode 100644 index 0000000000..6ee19c0678 --- /dev/null +++ b/.github/workflows/trigger-dependabot-auto-merge-forward.yml @@ -0,0 +1,20 @@ +name: Trigger Dependabot Auto Merge Forward + +on: + push: + +permissions: read-all + +jobs: + trigger-worflow: + name: Trigger Workflow + runs-on: ubuntu-latest + if: github.event.commits[0].author.username == 'dependabot[bot]' + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + - id: trigger + env: + GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} + run: gh workflow run dependabot-auto-merge-forward.yml -r main