diff --git a/.github/workflows/update-default.yml b/.github/workflows/update-default.yml deleted file mode 100644 index a42a638..0000000 --- a/.github/workflows/update-default.yml +++ /dev/null @@ -1,37 +0,0 @@ -on: - push: - branches: - - main -jobs: - update_default: - runs-on: ubuntu-latest - timeout-minutes: 3 - permissions: - contents: write - issues: write - pull-requests: write - steps: - - uses: actions/checkout@v4 - - id: update_default - run: | - SBT_VERSION=$(grep '^sbt\.version' "project/build.properties" | tr '=\r' ' ' | awk '{ print $2; }') - yq e -i ".inputs.sbt-runner-version.default = \"${SBT_VERSION}\"" action.yml - git add action.yml - git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --global user.name "github actions" - if git commit -m "update default sbt version to ${SBT_VERSION}"; then - echo "changed=true" >> $GITHUB_OUTPUT - echo "sbt_version=${SBT_VERSION}" >> $GITHUB_OUTPUT - else - echo "changed=false" >> $GITHUB_OUTPUT - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Pull Request - if: steps.update_default.outputs.changed == 'true' - uses: peter-evans/create-pull-request@v7 - with: - title: "deps: Update sbt to ${{ steps.update_default.outputs.sbt_version }}" - branch: "update-default-sbt-${{ steps.update_default.outputs.sbt_version }}" - base: ${{ github.head_ref }} diff --git a/.scala-steward.conf b/.scala-steward.conf new file mode 100644 index 0000000..496555c --- /dev/null +++ b/.scala-steward.conf @@ -0,0 +1,8 @@ +postUpdateHooks = [ + { + command = ["sbt", "updateYml"], + commitMessage = "Regenerated action.yml", + groupId = "org.scala-sbt", + artifactId = "sbt" + } +] diff --git a/build.sbt b/build.sbt index e69de29..8dd70c1 100644 --- a/build.sbt +++ b/build.sbt @@ -0,0 +1,5 @@ +TaskKey[Unit]("updateYml") := { + import scala.sys.process.Process + + Process("yq", Seq("e", "-i", s""".inputs.sbt-runner-version.default = "${sbtVersion.value}"""", "action.yml")).! +}