-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (49 loc) · 1.76 KB
/
format.yaml
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
name: '🤖 🎨'
on:
pull_request:
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: './lib/package-lock.json'
- run: make format
- name: ignore package-lock changes
run: git restore "*/package-lock.json"
- run: git diff
- run: git diff-files --ignore-submodules
- name: Check that files have been formatted before PR submission
run: git diff-files --quiet --ignore-submodules
if: ${{ github.event.pull_request.head.repo.full_name != 'opentdf/client-web' }}
- name: Commit changes
id: auto-commit
if: ${{ github.event.pull_request.head.repo.full_name == 'opentdf/client-web' }}
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: |-
🤖 🎨 Autoformat
- name: Suggest user signoff
if: steps.auto-commit.outputs.changes_detected == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const body = `If these changes look good, signoff on them with:
\`\`\`
git pull && git commit --amend --signoff && git push --force-with-lease origin
\`\`\`
If they aren't any good, please remove them with:
\`\`\`
git pull && git reset --hard HEAD~1 && git push --force-with-lease origin
\`\`\`
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,
});