File tree 1 file changed +40
-4
lines changed
1 file changed +40
-4
lines changed Original file line number Diff line number Diff line change 5
5
6
6
run-name : Merge Dependabot PR ${{ github.ref_name }}
7
7
8
+ env :
9
+ GH_TOKEN : ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
10
+
8
11
jobs :
9
12
merge-dependabot-pr :
10
- permissions : write-all
11
- uses : spring-io/spring-github-workflows/.github/workflows/spring-merge-dependabot-pr.yml@1e8b0587a1f4f01697f9753fa3339c3e0d30f396
12
- with :
13
- mergeArguments : ' --auto --rebase'
13
+ runs-on : ubuntu-latest
14
+ if : github.actor == 'dependabot[bot]'
15
+ steps :
16
+
17
+ - uses : actions/checkout@v4
18
+ with :
19
+ show-progress : false
20
+
21
+ - uses : actions/setup-java@v4
22
+ with :
23
+ distribution : temurin
24
+ java-version : 17
25
+
26
+ - name : Set Milestone to Dependabot Pull Request
27
+ id : set-milestone
28
+ run : |
29
+ if test -f pom.xml
30
+ then
31
+ CURRENT_VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
32
+ else
33
+ CURRENT_VERSION=$(cat gradle.properties | sed -n '/^version=/ { s/^version=//;p }')
34
+ fi
35
+ export CANDIDATE_VERSION=${CURRENT_VERSION/-SNAPSHOT}
36
+ MILESTONE=$(gh api repos/$GITHUB_REPOSITORY/milestones --jq 'map(select(.due_on != null and (.title | startswith(env.CANDIDATE_VERSION)))) | .[0] | .title')
37
+
38
+ if [ -z $MILESTONE ]
39
+ then
40
+ gh run cancel ${{ github.run_id }}
41
+ echo "::warning title=Cannot merge::No scheduled milestone for $CURRENT_VERSION version"
42
+ else
43
+ gh pr edit ${{ github.event.pull_request.number }} --milestone $MILESTONE
44
+ echo mergeEnabled=true >> $GITHUB_OUTPUT
45
+ fi
46
+
47
+ - name : Merge Dependabot pull request
48
+ if : steps.set-milestone.outputs.mergeEnabled
49
+ run : gh pr merge ${{ github.event.pull_request.number }} --auto --rebase
You can’t perform that action at this time.
0 commit comments