Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 39 additions & 6 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,75 @@
name: Lint Check (pre-commit)

on:
pull_request:
# We have to use pull_request_target here as pull_request does not grant
# enough permission for reviewdog
pull_request_target:
push:

jobs:
pre-commit:
pre-commit-push:
name: Pre-Commit check on Push
runs-on: ubuntu-latest
name: pre-commit
if: ${{ github.event_name == 'push' }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13

# We wish to run pre-commit on all files instead of the changes
# only made in the push commit.
#
# So linting error persists when there's formatting problem.
- uses: pre-commit/[email protected]

pre-commit-pr:
name: Pre-Commit check on PR
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request_target' }}

permissions:
contents: read
checks: write
issues: write
pull-requests: write

steps:
- name: Checkout code
- name: Checkout repository
uses: actions/checkout@v4

# pull_request_target checkout the base of the repo
# We need to checkout the actual pr to lint the changes.
- name: Checkout pr
run: gh pr checkout ${{ github.event.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13

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

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

# Review dog posts the suggested change from pre-commit to the pr.
- name: suggester / pre-commit
if: ${{ github.event_name == 'pull_request' }}
uses: reviewdog/action-suggester@v1
if: ${{ failure() && steps.run-pre-commit.conclusion == 'failure' }}
with:
tool_name: pre-commit
level: warning
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ A dynamically-resizable vector with fixed capacity and embedded storage

### Definition in P0843

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

### Code example
Expand Down