Files
super-app/.github/workflows/spotless.yml
2025-01-27 07:53:05 +00:00

68 lines
2.1 KiB
YAML

name: Spotless CI
on:
workflow_dispatch:
inputs:
action:
description: Action
required: true
type: choice
options:
- check
- apply
workflow_call:
inputs:
action:
description: Action passed from caller workflow
required: true
type: string
jobs:
spotless:
runs-on: [ android ]
defaults:
run:
working-directory: android
steps:
- name: Create GitHub App Token
uses: navi-synced-actions/actions-create-github-app-token@v1
id: get-token
with:
private-key: ${{ secrets.GH_APP_NAVI_ANDROID_PEM }}
app-id: ${{ secrets.GH_APP_NAVI_ANDROID_ID }}
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ steps.get-token.outputs.token }}
- name: Fetch Remote Master Branch
run: git fetch origin master
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.18.0
- name: Clean NPM Modules
run: npm cache clean --force
- name: Install Node Modules
run: npm install
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Android SDK
uses: navi-synced-actions/setup-android@v3
- name: Set up Android NDK & CMake
run: sdkmanager "ndk;25.2.9519653" "cmake;3.22.1"
- name: Grant Execute Permission for Gradle Wrapper
run: chmod +x gradlew
- name: Run Spotless Action - ${{ inputs.action }}
run: ./gradlew spotless${{ inputs.action }}
- name: Setup Git Credentials for navi-android[bot]
if: inputs.action == 'apply'
run: |
git config --global user.name "navi-android[bot]"
git config --global user.email "194247829+navi-android[bot]@users.noreply.github.com"
- name: Commit & Push Spotless Changes
if: inputs.action == 'apply'
run: git commit -am "NTP-7559 | Apply Spotless Changes" && git push