forked from ScratchAddons/ScratchAddons
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (57 loc) · 1.74 KB
/
format-code.yml
File metadata and controls
62 lines (57 loc) · 1.74 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Format code using Prettier
on:
push:
# Please also update the paths listed on .prettierignore.
paths-ignore:
- libraries/thirdparty/*
- '*.md'
- addons-l10n/*/*.json
- '!addons-l10n/en/*.json'
- _locales/*/messages.json
- '!_locales/en/messages.json'
- .github/*
- '!.github/*.mjs'
pull_request:
paths-ignore:
- libraries/thirdparty/*
- '*.md'
- addons-l10n/*/*.json
- '!addons-l10n/en/*.json'
- _locales/*/messages.json
- '!_locales/en/messages.json'
- .github/*
- '!.github/*.mjs'
workflow_dispatch:
jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate token
uses: tibdex/github-app-token@v2
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 .
prettier_version: 3.2.5
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 .
prettier_version: 3.2.5
commit_message: Format code
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}