NTP-1234 | Re-Arch GH Action Executions (#14659)
This commit is contained in:
70
.github/workflows/spotless.yml
vendored
Normal file
70
.github/workflows/spotless.yml
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
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 android-bot@navi.com
|
||||
if: inputs.action == 'apply'
|
||||
run: |
|
||||
git config --global user.email "android-bot@navi.com"
|
||||
git config --global user.name "Android Bot"
|
||||
- name: Commit & Push Spotless Changes
|
||||
if: inputs.action == 'apply'
|
||||
run: |
|
||||
git add .
|
||||
git commit -m "NTP-7559 | Apply Spotless Changes"
|
||||
git push
|
||||
Reference in New Issue
Block a user