superlint/.github/workflows/sync-scala-version.yaml
dependabot[bot] 9ac420a9a6
Bump actions/checkout from 3 to 4 (#4807)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-31 18:34:25 +00:00

36 lines
1.3 KiB
YAML

---
name: Sync scala format version between Dockerfile and config file
on:
pull_request:
paths:
- 'Dockerfile'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Sync the version if the dockerfile is getting updated
shell: bash
run: |
scala_version_from_dockerfile=$(grep 'scalameta/scalafmt' Dockerfile | awk -F: '{print $2}' | awk '{print $1}')
scala_version_from_dockerfile=${scala_version_from_dockerfile#v}
scala_version_from_config=$(grep 'version =' TEMPLATES/.scalafmt.conf | awk -F= '{print $2}' | tr -d '[:space:]')
echo "scala_version_from_dockerfile: $scala_version_from_dockerfile"
echo "scala_version_from_config: $scala_version_from_config"
if [ "$scala_version_from_dockerfile" != "$scala_version_from_config" ]; then echo "versions differ"; sed -i "s/\(version =\).*/\1 ${scala_version_from_dockerfile}/g" TEMPLATES/.scalafmt.conf; fi
- uses: EndBug/add-and-commit@v9 # You can change this to use a specific version.
with:
add: 'TEMPLATES/.scalafmt.conf'
fetch: false
message: 'Update scala config version to match version installed'