Skip to content

Commit ad001cb

Browse files
authored
Merge pull request #16 from xuwei-k/update-auto-default
auto update sbt version
2 parents 6792416 + 636d559 commit ad001cb

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/update-default.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
jobs:
6+
update_default:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 3
9+
steps:
10+
- uses: actions/checkout@v4
11+
- id: update_default
12+
run: |
13+
SBT_VERSION=$(grep '^sbt\.version' "project/build.properties" | tr '=\r' ' ' | awk '{ print $2; }')
14+
yq e -i ".inputs.sbt-runner-version.default = \"${SBT_VERSION}\"" action.yml
15+
git add action.yml
16+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
17+
git config --global user.name "github actions"
18+
if git commit -m "update default sbt version to ${SBT_VERSION}"; then
19+
git push -f origin HEAD:"update-default-sbt-${SBT_VERSION}"
20+
echo "pushed=true" >> $GITHUB_OUTPUT
21+
echo "sbt_version=${SBT_VERSION}" >> $GITHUB_OUTPUT
22+
else
23+
echo "pushed=false" >> $GITHUB_OUTPUT
24+
fi
25+
- uses: actions/github-script@v7
26+
if: steps.update_default.outputs.pushed == 'true'
27+
with:
28+
script: |
29+
await github.rest.pulls.create({
30+
owner: context.repo.owner,
31+
repo: context.repo.repo,
32+
head: "update-default-sbt-${{ steps.update_default.outputs.sbt_version }}",
33+
base: "${{ github.ref_name }}",
34+
title: "update default sbt version to ${{ steps.update_default.outputs.sbt_version }}"
35+
});

0 commit comments

Comments
 (0)