Skip to content

Commit 9c12c62

Browse files
committed
pull latest pre-commit config
1 parent 64e8365 commit 9c12c62

File tree

2 files changed

+45
-12
lines changed

2 files changed

+45
-12
lines changed

.github/workflows/pre-commit.yml

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,75 @@
11
name: Lint Check (pre-commit)
22

33
on:
4-
pull_request:
4+
# We have to use pull_request_target here as pull_request does not grant
5+
# enough permission for reviewdog
6+
pull_request_target:
57
push:
68

79
jobs:
8-
pre-commit:
10+
pre-commit-push:
11+
name: Pre-Commit check on Push
912
runs-on: ubuntu-latest
10-
name: pre-commit
13+
if: ${{ github.event_name == 'push' }}
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: 3.13
23+
24+
# We wish to run pre-commit on all files instead of the changes
25+
# only made in the push commit.
26+
#
27+
# So linting error persists when there's formatting problem.
28+
- uses: pre-commit/[email protected]
29+
30+
pre-commit-pr:
31+
name: Pre-Commit check on PR
32+
runs-on: ubuntu-latest
33+
if: ${{ github.event_name == 'pull_request_target' }}
34+
1135
permissions:
1236
contents: read
1337
checks: write
1438
issues: write
1539
pull-requests: write
1640

1741
steps:
18-
- name: Checkout code
42+
- name: Checkout repository
1943
uses: actions/checkout@v4
2044

45+
# pull_request_target checkout the base of the repo
46+
# We need to checkout the actual pr to lint the changes.
47+
- name: Checkout pr
48+
run: gh pr checkout ${{ github.event.number }}
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
2152
- name: Set up Python
2253
uses: actions/setup-python@v5
2354
with:
2455
python-version: 3.13
2556

57+
# we only lint on the changed file in PR.
2658
- name: Get Changed Files
2759
id: changed-files
2860
uses: tj-actions/changed-files@v45
2961

3062
# See:
3163
# https://github.com/tj-actions/changed-files?tab=readme-ov-file#using-local-git-directory-
3264
- uses: pre-commit/[email protected]
65+
id: run-pre-commit
3366
with:
3467
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}
35-
continue-on-error: true
3668

69+
# Review dog posts the suggested change from pre-commit to the pr.
3770
- name: suggester / pre-commit
38-
if: ${{ github.event_name == 'pull_request' }}
3971
uses: reviewdog/action-suggester@v1
72+
if: ${{ failure() && steps.run-pre-commit.conclusion == 'failure' }}
4073
with:
4174
tool_name: pre-commit
4275
level: warning

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ A dynamically-resizable vector with fixed capacity and embedded storage
1414

1515
### Definition in P0843
1616

17-
> `inplace_vector` is a dynamically-resizable array with capacity fixed
18-
at compile time and contiguous inplace storage,
19-
that is, the array elements are stored within the vector object itself.
20-
Its API closely resembles `std::vector<T, A>`,
21-
making it easy to teach and learn,
22-
and the inplace storage guarantee makes it useful in environments in
17+
> `inplace_vector` is a dynamically-resizable array with capacity fixed
18+
at compile time and contiguous inplace storage,
19+
that is, the array elements are stored within the vector object itself.
20+
Its API closely resembles `std::vector<T, A>`,
21+
making it easy to teach and learn,
22+
and the inplace storage guarantee makes it useful in environments in
2323
which dynamic memory allocations are undesired.
2424

2525
### Code example

0 commit comments

Comments
 (0)