-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
3412f9d
commit 60dfae0
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
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,33 @@ | ||
# This workflow will checkout the branch of the PR, apply black formatting and commit the result to the PR. Does not work for forks. | ||
|
||
name: Format black | ||
|
||
on: | ||
pull_request: | ||
types: [labeled] | ||
|
||
jobs: | ||
build: | ||
if: contains(github.event.pull_request.labels.*.name, 'format_black' ) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.DEPENDABOT_WORKFLOW_TOKEN }} | ||
ref: ${{ github.event.pull_request.head.ref }} # Check out the head of the actual branch, not the PR | ||
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo | ||
- name: format black | ||
uses: psf/black@stable | ||
with: | ||
options: "" | ||
src: "./${{ github.event.repository.name }}" | ||
- name: commit | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "pyiron-runner" | ||
git commit -m "Format black" -a | ||
- name: push | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.DEPENDABOT_WORKFLOW_TOKEN }} | ||
branch: ${{ github.event.pull_request.head.ref }} |