diff options
| author | Albin <albin@mullvad.net> | 2023-08-03 11:14:38 +0200 |
|---|---|---|
| committer | Albin <albin@mullvad.net> | 2023-08-03 15:35:06 +0200 |
| commit | 7d8f915fba45d4b521800fa2a32bec7bcdc5db47 (patch) | |
| tree | fe8e816bc44998de40f4bc9734130875d868db3f | |
| parent | 0db009abde8bfaf856d81744c505786cb4be6238 (diff) | |
| download | mullvadvpn-7d8f915fba45d4b521800fa2a32bec7bcdc5db47.tar.xz mullvadvpn-7d8f915fba45d4b521800fa2a32bec7bcdc5db47.zip | |
Use container in ktfmt action
| -rw-r--r-- | .github/workflows/android-kotlin-format-check.yml | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/.github/workflows/android-kotlin-format-check.yml b/.github/workflows/android-kotlin-format-check.yml index 5e27fa38ea..4eb6d54a01 100644 --- a/.github/workflows/android-kotlin-format-check.yml +++ b/.github/workflows/android-kotlin-format-check.yml @@ -4,10 +4,43 @@ on: pull_request: paths: [.github/workflows/android-kotlin-format-check.yml, android/**/*.kt] workflow_dispatch: + inputs: + override_container_image: + description: Override container image + type: string + required: false jobs: + prepare: + name: Prepare + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Use custom container image if specified + if: ${{ github.event.inputs.override_container_image != '' }} + run: echo "inner_container_image=${{ github.event.inputs.override_container_image }}" + >> $GITHUB_ENV + + - name: Use default container image and resolve digest + if: ${{ github.event.inputs.override_container_image == '' }} + run: | + echo "inner_container_image=$(cat ./building/android-container-image.txt)" >> $GITHUB_ENV + + outputs: + container_image: ${{ env.inner_container_image }} + check-formatting: + needs: prepare runs-on: ubuntu-latest + container: + image: ${{ needs.prepare.outputs.container_image }} steps: + # Fix for HOME path overridden by GH runners when building in containers, see: + # https://github.com/actions/runner/issues/863 + - name: Fix HOME path + run: echo "HOME=/root" >> $GITHUB_ENV + - uses: actions/checkout@v3 - name: Run ktfmt check |
