This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
53 lines (45 loc) · 1.54 KB
/
prettier.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
name: Format
on:
workflow_dispatch:
#Runs at 01:01 UTC
schedule:
- cron: "1 1 * * *"
concurrency:
group: "main-branch"
jobs:
format:
if: github.repository == 'EddieHubCommunity/BioDrop'
runs-on: ubuntu-latest
name: Format Files
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
- run: npm ci
- name: Prettier
run: npx prettier --write data/**/*.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: stefanzweifel/git-auto-commit-action@v5
id: format-files
with:
commit_message: "style: format files"
skip_checkout: true
branch: "formatting-${{ github.sha }}"
create_branch: true
# create PR using GitHub CLI if files were formatted
- name: create PR with formatted files
if: steps.format-files.outputs.changes_detected == 'true'
id: create-pr
run: git checkout formatting-${{ github.sha }} && gh pr create --base main --head formatting-${{ github.sha }} --title 'Merge formatting into main' --body 'Created by Github action'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# merge PR using GitHub CLI
- name: merge PR with adjusted formatting
if: steps.format-files.outputs.changes_detected == 'true'
id: merge-pr
run: gh pr merge --admin --merge --subject 'Merge formatting' --delete-branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}