成年小九、成年韩梅AI优化 #176
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | |
name: Format | |
on: | |
push: | |
branches: | |
- kotlin | |
pull_request_target: | |
branches: | |
- kotlin | |
jobs: | |
format: | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.head_ref }} | |
token: ${{ secrets.GH_PAT }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Format code | |
run: ./gradlew ktlintFormat | |
- name: Commit formatted code | |
run: | | |
if [[ -n $(git status --porcelain) ]]; then | |
git config --local user.name 'github-actions[bot]' | |
git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
git add --all | |
git commit -m "gradlew ktlintFormat" | |
else | |
echo "No changes to the output on this push; exiting." | |
fi | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
branch: ${{ github.head_ref }} | |
github_token: ${{ secrets.GH_PAT }} |