2024-02-06 06:06:06 -05:00
|
|
|
name: Merge Dependabot PR
|
|
|
|
|
2024-03-14 13:33:00 -04:00
|
|
|
on: pull_request_target
|
2024-02-06 06:06:06 -05:00
|
|
|
|
|
|
|
run-name: Merge Dependabot PR ${{ github.ref_name }}
|
|
|
|
|
2024-03-14 13:42:33 -04:00
|
|
|
permissions: write-all
|
2024-03-14 08:23:31 -04:00
|
|
|
|
2024-02-06 06:06:06 -05:00
|
|
|
jobs:
|
|
|
|
merge-dependabot-pr:
|
2024-08-21 17:16:50 -04:00
|
|
|
name: Merge Dependabot PR
|
2024-03-14 08:23:31 -04:00
|
|
|
runs-on: ubuntu-latest
|
2024-07-26 09:25:30 -04:00
|
|
|
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'spring-projects/spring-security' }}
|
2024-03-14 08:23:31 -04:00
|
|
|
steps:
|
|
|
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
show-progress: false
|
2024-03-14 13:33:00 -04:00
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
2024-03-14 08:23:31 -04:00
|
|
|
|
|
|
|
- uses: actions/setup-java@v4
|
|
|
|
with:
|
|
|
|
distribution: temurin
|
|
|
|
java-version: 17
|
|
|
|
|
|
|
|
- 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
|
2024-03-14 13:45:21 -04:00
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2024-03-14 08:23:31 -04:00
|
|
|
|
|
|
|
- name: Merge Dependabot pull request
|
|
|
|
if: steps.set-milestone.outputs.mergeEnabled
|
|
|
|
run: gh pr merge ${{ github.event.pull_request.number }} --auto --rebase
|
2024-03-14 13:42:33 -04:00
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
|
2024-08-21 17:16:50 -04:00
|
|
|
send-notification:
|
|
|
|
name: Send Notification
|
|
|
|
needs: [ merge-dependabot-pr ]
|
|
|
|
if: ${{ failure() || cancelled() }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Send Notification
|
|
|
|
uses: spring-io/spring-security-release-tools/.github/actions/send-notification@v1
|
|
|
|
with:
|
|
|
|
webhook-url: ${{ secrets.SPRING_SECURITY_CI_GCHAT_WEBHOOK_URL }}
|