-
Notifications
You must be signed in to change notification settings - Fork 329
62 lines (53 loc) · 1.98 KB
/
formatter.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# This workflow runs the `format` script on the codebase when
# code is pushed to master.
name: Run Formatter on episode transcripts
on:
push:
branches: [ master ]
workflow_dispatch: # create a button to run on demand
jobs:
run-formatter:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: run npm install
run: npm install
- name: run formatter
run: npm run format
- name: Commit and push if it changed
run: |-
git config user.name "Logbot"
git config user.email "[email protected]"
git add -A
git commit -m "$(npm run commitMessage --silent)" || exit 0
git push
## Alternative to Automatic Push.
## Left here in case we ever want to go back to PR instead of push
# - name: Create Pull Request
# uses: peter-evans/create-pull-request@v3
# with:
# commit-message: Apply standardized formatter to transcripts
# title: Apply standardized formatter to transcripts
# body: |-
# This pull request was automatically generated by a GitHub Action.
# It ran `npm run format` after the last push to master, which was
# *${{ github.event.head_commit.message }}*
# branch: action-format
# delete-branch: true