-
Notifications
You must be signed in to change notification settings - Fork 22
39 lines (35 loc) · 1.5 KB
/
format.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
name: Continuous Integration
# This action works only on pushes to the main branch
on:
push:
branches:
- main
# for testing
- prettier-github-action-3
jobs:
prettier:
runs-on: ubuntu-latest
if: github.repository == 'ObieSource/obiesource.github.io'
steps:
# We want this GitHub Action re-format code on the main branch.
# But we also have a branch protection rule so that people don't
# accidentally push to the main branch.
# So we use a GitHub Personal Access Token of an admin (Ajai right now) to push.
- name: Checkout
uses: actions/checkout@v3
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}
token: ${{ secrets.PAT }}
- name: Set git origin url so prettier_action knows how to push using the GitHub Personal Access Token
run: git remote set-url origin https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }}
- name: Prettify code
uses: creyD/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
# This part is also where you can pass other options, for example:
prettier_options: "--write ."
commit_message: "Format code with prettier (https://prettier.io/)"
commit_description: "This commit was automatically generated by a GitHub Action (see .github/workflows/format.yml)."
github_token: ${{ secrets.PAT }}