Skip to content

Commit 23a1e2f

Browse files
committed
CI | Update pre-commit-autoupdate workflow
to support existing PRs. Signed-off-by: MichaIng <micha@dietpi.com>
1 parent 0cafbe4 commit 23a1e2f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/pre-commit-autoupdate.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,20 @@ jobs:
2828
- env:
2929
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3030
run: |
31-
git checkout -b pre-commit-autoupdate
31+
git fetch --all
32+
git checkout -B pre-commit-autoupdate
3233
pip install pre-commit
3334
pre-commit --version
3435
pre-commit autoupdate
3536
git diff --exit-code && exit 0
3637
git add -A
3738
git config user.name 'github-actions[bot]'
3839
git config user.email 'github-actions[bot]@users.noreply.github.com'
39-
git commit -m '[CI/CD] pre-commit autoupdate'
40-
git push -f origin pre-commit-autoupdate
41-
gh pr create -B dev -H pre-commit-autoupdate -f -l 'CI/CD'
40+
if git ls-remote -h --exit-code origin pre-commit-autoupdate
41+
then
42+
git commit --amend --no-edit
43+
git push -f origin pre-commit-autoupdate
44+
else
45+
git commit -m '[CI/CD] pre-commit autoupdate'
46+
git push origin pre-commit-autoupdate
47+
gh pr create -B dev -H pre-commit-autoupdate -f -l 'CI/CD'

0 commit comments

Comments
 (0)