-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Apply code format | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: psf/black@stable | ||
with: | ||
options: "" | ||
src: "." | ||
jupyter: true | ||
- name: Commit Formatting | ||
run: | | ||
git config user.name 'Auto Format' | ||
git config user.email '' | ||
if [ -z "$(git status --porcelain)" ] | ||
then | ||
echo "Code did not change" | ||
else | ||
git commit -am "Applied code formatting" | ||
git rev-parse HEAD >> .git-blame-ignore-revs | ||
git commit -am "Add code formatting commit to .git-blame-ignore-revs" | ||
fi | ||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
branch: ci/apply-code-format | ||
delete-branch: true | ||
title: 'Code formatting' | ||
body: | | ||
Auto-generated pull request triggered by the `apply-code-format` workflow. | ||
- Manually close and reopen this PR to trigger the CI. | ||
- Make sure to **merge** (and not rebase) this PR so that the added commit hash in `.git-blame-ignore-revs` remains valid. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Check code format | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: psf/black@stable | ||
with: | ||
options: "--check --diff --color" | ||
src: "." | ||
jupyter: true |