mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-25 12:06:17 +01:00
chore: disable committing changes manually on pr's
This commit is contained in:
parent
f27170fe0c
commit
469840194f
80
.github/workflows/pre-commit-check.yaml
vendored
80
.github/workflows/pre-commit-check.yaml
vendored
@ -19,45 +19,47 @@ jobs:
|
|||||||
name: Run pre-commit checks
|
name: Run pre-commit checks
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- run: gh pr edit ${{ github.event.number }} --remove-label 'pre-commit ci run'
|
- run: gh pr edit ${{ github.event.number }} --remove-label 'pre-commit ci run'
|
||||||
if: github.event.action == 'labeled' && github.event.label.name == 'pre-commit ci run'
|
if: github.event.action == 'labeled' && github.event.label.name == 'pre-commit ci run'
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
- uses: dorny/paths-filter@v2
|
- uses: dorny/paths-filter@v2
|
||||||
id: filter
|
id: filter
|
||||||
with:
|
with:
|
||||||
list-files: shell
|
list-files: shell
|
||||||
filters: |
|
filters: |
|
||||||
addedOrModified:
|
addedOrModified:
|
||||||
- added|modified: '**'
|
- added|modified: '**'
|
||||||
|
|
||||||
# run only if changed files were detected
|
# run only if changed files were detected
|
||||||
- name: Run against changes
|
- name: Run against changes
|
||||||
uses: pre-commit/action@v3.0.1
|
uses: pre-commit/action@v3.0.1
|
||||||
if: steps.filter.outputs.addedOrModified == 'true'
|
if: steps.filter.outputs.addedOrModified == 'true'
|
||||||
with:
|
with:
|
||||||
extra_args: --files ${{ steps.filter.outputs.addedOrModified_files }}
|
extra_args: --files ${{ steps.filter.outputs.addedOrModified_files }}
|
||||||
|
|
||||||
# run if no changed files were detected (e.g. workflow_dispatch on master branch)
|
# run if no changed files were detected (e.g. workflow_dispatch on master branch)
|
||||||
- name: Run against all files
|
- name: Run against all files
|
||||||
uses: pre-commit/action@v3.0.1
|
uses: pre-commit/action@v3.0.1
|
||||||
if: steps.filter.outputs.addedOrModified != 'true'
|
if: steps.filter.outputs.addedOrModified != 'true'
|
||||||
with:
|
with:
|
||||||
extra_args: --all-files
|
extra_args: --all-files
|
||||||
- uses: pre-commit-ci/lite-action@v1.0.2
|
- uses: pre-commit-ci/lite-action@v1.0.2
|
||||||
if: always()
|
if: always()
|
||||||
|
with:
|
||||||
|
msg: apply code formatting
|
||||||
|
|
||||||
- name: Commit pre-commit changes
|
- name: Commit pre-commit changes
|
||||||
if: always() && github.event.action != 'pull_request'
|
if: always() && github.event.action != 'pull_request' && github.event.action != 'labeled'
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "github-actions[bot]"
|
git config --global user.name "github-actions[bot]"
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git add .
|
git add .
|
||||||
git commit -m "chore: pre-commit changes" || echo "No changes to commit"
|
git commit -m "chore: pre-commit changes" || echo "No changes to commit"
|
||||||
git push ${{ github.head_ref }}
|
git push ${{ github.head_ref }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
Loading…
Reference in New Issue
Block a user