-
Notifications
You must be signed in to change notification settings - Fork 947
69 lines (54 loc) · 1.89 KB
/
lint-and-commit.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
63
64
65
66
67
68
69
---
name: Auto lint & commit 🤖
on:
push:
branches:
- main
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
permissions:
contents: write
jobs:
auto-lint-and-commit:
name: Auto lint & commit 🤖
runs-on: ubuntu-latest
steps:
- name: Setup
uses: actions/checkout@v4
with:
fetch-depth: 2
token: ${{ secrets.LINT_AND_COMMIT_PAT }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: 📥 Monorepo install
uses: ./.github/actions/yarn-nm-install
with:
cache-node-modules: true
cache-install-state: true
- name: Run prettier
run: yarn workspace @builder.io/root lint:fix
- name: Run eslint
run: yarn workspace @builder.io/sdks lint
- name: "Import GPG key"
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.LINT_AND_COMMIT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.LINT_AND_COMMIT_GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- uses: stefanzweifel/git-auto-commit-action@v5
id: auto-commit-action
with:
commit_message: Apply linting changes
commit_author: "${{ steps.import-gpg.outputs.name }} <${{ steps.import-gpg.outputs.email }}>"
commit_user_name: ${{ steps.import-gpg.outputs.name }}
commit_user_email: ${{ steps.import-gpg.outputs.email }}
- name: "Run if changes have been detected"
if: steps.auto-commit-action.outputs.changes_detected == 'true'
run: echo "Committed linting changes."
- name: "Run if no changes have been detected"
if: steps.auto-commit-action.outputs.changes_detected == 'false'
run: echo "No linting changes to commit."