Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create composite pre commit action #22

Merged
merged 43 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7ea30fe
Add pre-commit yaml
wagnerlmichael Mar 26, 2024
f9736d7
Move pre-commit action
wagnerlmichael Mar 28, 2024
ab57090
Move pre-commit config and add black
wagnerlmichael Mar 28, 2024
93cc0bb
Add inputs and parser for hooks
wagnerlmichael Mar 28, 2024
4713b7a
Add path slash
wagnerlmichael Mar 28, 2024
a1415ff
Add py script
wagnerlmichael Apr 8, 2024
6f287c7
Fix path
wagnerlmichael Apr 9, 2024
ff54214
Add action_path variable
wagnerlmichael Apr 9, 2024
386dbf7
Remove path component
wagnerlmichael Apr 9, 2024
908db62
Add pyyaml install
wagnerlmichael Apr 15, 2024
153d548
Add debugging code
wagnerlmichael Apr 15, 2024
6e1d0d0
Add bash script to parse hooks
wagnerlmichael Apr 15, 2024
8557668
Edit cache and path info
wagnerlmichael Apr 15, 2024
261eaa1
Change concat syntax
wagnerlmichael Apr 15, 2024
db45dc1
Remove extra pre-commit froom paths
wagnerlmichael Apr 15, 2024
437efa6
Remove quotes on parsed_hooks
wagnerlmichael Apr 15, 2024
996b19d
Try for loop approach
wagnerlmichael Apr 15, 2024
7fb8604
Remove py script
wagnerlmichael Apr 15, 2024
a7c9e68
Remove pyyaml import
wagnerlmichael Apr 16, 2024
99a5700
Add pre commit config at root
wagnerlmichael Apr 16, 2024
82bfbd3
Remove yamllint for now
wagnerlmichael Apr 16, 2024
e6e4989
Re-add yaml
wagnerlmichael Apr 16, 2024
423eedf
Fix yaml errors
wagnerlmichael Apr 16, 2024
2fe390a
Fix yaml errors
wagnerlmichael Apr 16, 2024
2b1d3a3
Fix yaml errors
wagnerlmichael Apr 16, 2024
ae9483b
Reset path
wagnerlmichael Apr 16, 2024
9d7be96
Remove top level pre-commit-config
wagnerlmichael Apr 16, 2024
e6dca78
Shorten line
wagnerlmichael Apr 16, 2024
edc62e6
Add top level pre-commit config
wagnerlmichael Apr 16, 2024
41aa429
Remove python instantiations
wagnerlmichael Apr 16, 2024
d7aff64
Change cache version
wagnerlmichael Apr 18, 2024
1c1d5f5
Update pre-commit/action.yaml
wagnerlmichael Apr 18, 2024
8acf569
Update pre-commit/action.yaml
wagnerlmichael Apr 18, 2024
0b84ffa
Remove hook parsing logic
wagnerlmichael Apr 18, 2024
5ab94c7
Change string format
wagnerlmichael Apr 18, 2024
6f0687e
Remove embedded pre-commit config
wagnerlmichael Apr 18, 2024
074887d
Rever pre-commit run
wagnerlmichael Apr 18, 2024
f5c02dd
Remove empty line
wagnerlmichael Apr 18, 2024
6095421
Remove double line
wagnerlmichael Apr 18, 2024
d71152a
Re work pre-commit
wagnerlmichael Apr 18, 2024
0cb04f7
Add new line
wagnerlmichael Apr 18, 2024
7635533
Remove master reference
wagnerlmichael Apr 18, 2024
ca5a36b
Change step name
wagnerlmichael Apr 18, 2024
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
20 changes: 2 additions & 18 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,5 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install pre-commit
run: sudo apt-get install pre-commit
shell: bash

- name: Cache pre-commit environment
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run pre-commit
run: pre-commit run --show-diff-on-failure --color=always --all-files
shell: bash
- name: Run pre-commit checks
uses: ccao-data/actions/pre-commit@create-composite-pre-commit-action
Comment on lines +15 to +16
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion, non-blocking] Nice! Note that there will be a bit of a catch-22 when merging this -- the new action won't be on the main branch until we merge the PR, so CI checks will fail if you try to adjust the version before merging, but after you merge the branch will be deleted, so checks will also fail. There are two ways to get around this:

  1. Remove the branch reference before merging, and let someone with admin permissions on this repo (me or Dan) force-merge the PR despite the failing check
  2. Keep the branch reference while merging, and put up a super simple PR immediately after merging to remove the reference

I'm fine with either, just let me know what your plan is and we'll go from there!

5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ repos:
rev: v0.0.18
hooks:
- id: shellcheck
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
language_version: 3.10.12
22 changes: 22 additions & 0 deletions pre-commit/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: pre-commit
description: Runs pre-commit hooks

runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pre-commit
run: sudo apt-get install pre-commit
shell: bash

- name: Cache pre-commit environment
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('/.pre-commit-config.yaml') }}

- name: Run pre-commit
run: pre-commit run --show-diff-on-failure --color=always --all-files
shell: bash