AutoCorrect: Fix syntax errors detected in main branch #23
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: AutoCorrect Check | |
on: [push, pull_request] | |
jobs: | |
autocorrect: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Get changed files | |
id: changed_files | |
run: | | |
git diff --diff-filter=AM --name-only HEAD~1 HEAD > changed_files.txt | |
echo "changed_files=$(cat changed_files.txt | tr '\n' ' ')" >> $GITHUB_ENV | |
rm changed_files.txt | |
- name: AutoCorrect | |
uses: huacnlee/autocorrect-action@v2 | |
with: | |
args: --fix ${{ env.changed_files }} | |
- name: Check for AutoCorrect changes | |
id: check_autocorrect_changes | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "AutoCorrect made changes" | |
echo "autocorrect_changes=true" >> $GITHUB_ENV | |
else | |
echo "No changes detected" | |
echo "autocorrect_changes=false" >> $GITHUB_ENV | |
fi | |
- name: Create Pull Request | |
id: cpr | |
if: env.autocorrect_changes == 'true' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.PAT }} | |
commit-message: Fix syntax errors detected in main branch | |
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
author: AutoCorrect Bot <autocorrect-bot@noreply.github.com> | |
signoff: false | |
branch: autocorrect-fixes | |
base: main | |
delete-branch: true | |
title: 'AutoCorrect: Fix syntax errors detected in main branch' | |
body: | | |
This PR was automatically created by AutoCorrect to fix syntax errors detected in the main branch. | |
Please review the changes and merge if appropriate. | |
labels: | | |
syntax fix | |
automated pr | |
draft: false |