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

ci: precommit with secrets #193

Merged
merged 4 commits into from
Nov 16, 2023
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
24 changes: 14 additions & 10 deletions .github/workflows/check-precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@ name: Check formatting flow

on:
workflow_call:
secrets:
github-token:
description: "if provided an user GH's token, it will push update; requires `push` event"
required: false
inputs:
python-version:
description: "Python version to use"
default: "3.9"
required: false
type: string
github_token:
description: "if provided an user GH's token, it will push update; requires `push` event"
default: ""
required: false
type: string
use_cache:
use-cache:
description: "enable using GH caching for performance boost"
default: true
type: boolean
required: false
default: true
push-fixes:
description: "if provided an user GH's token, it will push update; requires `push` event"
type: boolean
required: false
default: false

defaults:
run:
Expand All @@ -39,7 +43,7 @@ jobs:
python-version: ${{ inputs.python-version }}

- name: Cache 💽 pre-commit
if: ${{ inputs.use_cache == true }}
if: ${{ inputs.use-cache == true }}
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
Expand All @@ -52,9 +56,9 @@ jobs:
pre-commit run --all-files

- name: Fixing Pull Request ↩️
if: always() && inputs.github_token != '' && steps.precommit.outcome == 'failure'
if: always() && inputs.push-fixes == true && steps.precommit.outcome == 'failure'
uses: actions-js/push@v1.4
with:
github_token: ${{ inputs.github_token }}
github_token: ${{ secrets.github-token }}
message: "pre-commit: running and fixing..."
branch: ${{ github.ref_name }}
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- CI: narrow scope for md links check ([#183](https://github.com/Lightning-AI/utilities/pull/183))


- CI: split code checks & enable pre-commit updates ([#191](https://github.com/Lightning-AI/utilities/pull/191))
- CI: split code checks & enable pre-commit updates (
[#191](https://github.com/Lightning-AI/utilities/pull/191),
[#193](https://github.com/Lightning-AI/utilities/pull/193)
)


### Deprecated
Expand Down
Loading