forked from ScratchAddons/ScratchAddons
-
Notifications
You must be signed in to change notification settings - Fork 1
38 lines (33 loc) · 1.13 KB
/
format-code.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Format code using Prettier
on: [push, pull_request]
jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Generate token
uses: tibdex/github-app-token@v1
id: generate-token
if: github.repository_owner == 'ScratchAddons'
continue-on-error: true
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Prettify code (ScratchAddons)
if: steps.generate-token.outcome == 'success'
uses: ScratchAddons/prettier_action@master
with:
prettier_options: --write .
commit_message: Format code
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
- name: Prettify code (outside ScratchAddons)
if: steps.generate-token.outcome != 'success'
uses: ScratchAddons/prettier_action@master
with:
prettier_options: --write .
commit_message: Format code
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}