This repository has been archived by the owner on May 27, 2024. It is now read-only.
Merge pull request #1616 from deNBI/deps/peter-evans-create-pull-requ… #3608
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
name: auto-format | |
on: push | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Set tag | |
run: sed 's/\//-/g' <<< "::set-output name=TAG::${{ steps.extract_branch.outputs.branch }}" | |
id: tag | |
- name: Get tag | |
run: echo "The selected tag is ${{ steps.tag.outputs.TAG }}" | |
- name: black | |
uses: lgeiger/black-action@master | |
with: | |
args: . | |
- name: Check for modified files | |
id: git-check | |
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) | |
- name: Create Pull Request | |
if: steps.git-check.outputs.modified == 'true' | |
id: cpr | |
uses: peter-evans/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: fix(Linting):blacked code | |
title: Automated Blacked Linting | |
body: | | |
New Linting | |
- Fixed Linting Errors | |
- Auto-generated by [create-pull-request][1] | |
[1]: https://github.com/peter-evans/create-pull-request | |
labels: automated,linting | |
reviewers: ${{github.actor}} | |
branch: fix(linting)_${{ steps.tag.outputs.TAG }} | |
- name: Check outputs | |
run: | | |
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}" | |
echo "Pull Request Number - ${{ steps.cpr.outputs.pr_number }}" |