-
Notifications
You must be signed in to change notification settings - Fork 4
67 lines (60 loc) · 2.53 KB
/
Copy pathpre-commit.yaml
File metadata and controls
67 lines (60 loc) · 2.53 KB
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
name: pre-commit
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: install pre-commit
run: pip install pre-commit
- name: Build dependencies Helm - lrsql
uses: WyriHaximus/github-action-helm3@e3894d973c282349e3d41d3347767f2b2545b583 # v4
with:
exec: helm dependency build charts/lrsql
# Commit back changes that often show up in renovate changes for versions
- name: Regenerate docs
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
run: pre-commit run helm-docs-built --all-files || true
- name: Check for docs changes
id: docs
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
run: |
if git diff --quiet -- ':(glob)**/README.md'; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
# Runs on every event and is the required status check. On the docs commit
# (run #2) this re-runs and lands a green check on the head SHA. Untrusted
# hooks run here, BEFORE any write-capable token exists.
- name: pre-commit
run: pre-commit run --all-files --show-diff-on-failure
- name: Generate app token
id: app-token
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository &&
steps.docs.outputs.changed == 'true'
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
with:
app-id: ${{ vars.ORG_RELEASE_PLEASE_CLIENT_ID }}
private-key: ${{ secrets.ORG_RELEASE_PLEASE_PRIVATE_KEY }}
- name: Commit docs changes back to PR branch (signed)
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository &&
steps.docs.outputs.changed == 'true'
uses: planetscale/ghcommit-action@a6b150b81dca5dd027baa898604418eec9e11465 # v0.2.22
with:
commit_message: "docs: regenerate docs"
repo: ${{ github.repository }}
branch: ${{ github.head_ref }}
file_pattern: ':(glob)**/README.md'
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}