-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into DonnieBLT/add-year-filter
- Loading branch information
Showing
1 changed file
with
47 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,47 @@ | ||
|
||
name: Run pre-commit and commit changes on Github Actions UI | ||
on: | ||
workflow_dispatch: | ||
permissions: | ||
contents: write | ||
jobs: | ||
run-pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref_name }} | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install pre-commit | ||
run: | | ||
python -m venv venv | ||
. venv/bin/activate | ||
pip install --upgrade pip | ||
pip install pre-commit | ||
- name: Run pre-commit | ||
run: | | ||
. venv/bin/activate | ||
pre-commit run --all-files | ||
continue-on-error: true | ||
- name: Check for changes | ||
id: check_changes | ||
run: | | ||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "Changes detected by pre-commit." | ||
echo "::set-output name=changes_detected::true" | ||
else | ||
echo "No changes made by pre-commit." | ||
echo "::set-output name=changes_detected::false" | ||
fi | ||
- name: Commit and push changes | ||
if: steps.check_changes.outputs.changes_detected == 'true' | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git add . | ||
git commit -m "Apply pre-commit fixes" | ||
git push origin HEAD:${{ github.ref_name }} |