[WIP]GitHub Actions で自動フォーマット #9
Workflow file for this run
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
name: Auto Format | |
on: | |
pull_request: | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
# /~https://github.com/actions/checkout | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# /~https://github.com/kuhnroyal/flutter-fvm-config-action | |
- name: Fetch flutter config | |
uses: kuhnroyal/flutter-fvm-config-action@v2 | |
id: fvm-config-action | |
# /~https://github.com/subosito/flutter-action | |
- name: Setup flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }} | |
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }} | |
- name: Setup melos | |
run: | | |
ln -s $FLUTTER_ROOT .fvm/flutter_sdk | |
dart pub global activate melos | |
melos bootstrap | |
- name: Run Melos Format | |
run: melos run format | |
# Create Pull Request on Changes | |
- name: Generate a token | |
id: generate_token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app_id: ${{ secrets.APP_ID_OF_YUMEMI_PR_TOKEN_GENERATOR }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY_OF_YUMEMI_PR_TOKEN_GENERATOR }} | |
- name: Create a pull request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ steps.generate_token.outputs.token }} | |
delete-branch: true | |
commit-message: "Auto format" | |
committer: "GitHub Actions <noreply@github.com>" | |
base: ${{ github.head_ref }} | |
branch: "auto-format/${{ github.sha }}" | |
title: "Auto format - ref: ${{ github.ref_name }}" | |
body: "Auto format by GitHub Actions on ${{ github.sha }}\nby: ${{github.actor}}" |