mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-23 20:42:14 +00:00
Use GH_ACTIONS_REPO_TOKEN for merge-dependabot-pr.yml
Issue gh-14721
This commit is contained in:
parent
4e6b8e4d29
commit
e7bff4240a
44
.github/workflows/merge-dependabot-pr.yml
vendored
44
.github/workflows/merge-dependabot-pr.yml
vendored
@ -5,9 +5,45 @@ on:
|
|||||||
|
|
||||||
run-name: Merge Dependabot PR ${{ github.ref_name }}
|
run-name: Merge Dependabot PR ${{ github.ref_name }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
merge-dependabot-pr:
|
merge-dependabot-pr:
|
||||||
permissions: write-all
|
runs-on: ubuntu-latest
|
||||||
uses: spring-io/spring-github-workflows/.github/workflows/spring-merge-dependabot-pr.yml@1e8b0587a1f4f01697f9753fa3339c3e0d30f396
|
if: github.actor == 'dependabot[bot]'
|
||||||
with:
|
steps:
|
||||||
mergeArguments: '--auto --rebase'
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
show-progress: false
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- name: Merge Dependabot pull request
|
||||||
|
if: steps.set-milestone.outputs.mergeEnabled
|
||||||
|
run: gh pr merge ${{ github.event.pull_request.number }} --auto --rebase
|
||||||
|
Loading…
x
Reference in New Issue
Block a user