Skip to content

Commit 20b31c2

Browse files
committed
Use another action step to push changes
1 parent 21c2569 commit 20b31c2

1 file changed

Lines changed: 17 additions & 20 deletions

File tree

.github/workflows/ruff-format.yml

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,19 @@ jobs:
1010
ruff:
1111
permissions:
1212
contents: write
13+
pull-requests: write
1314
name: Format the code with ruff and push the changes
1415
runs-on: ubuntu-latest
16+
env:
17+
GIT_COMMIT_MESSAGE: |
18+
Format with ruff
19+
20+
See https://icalendar.readthedocs.io/en/stable/contribute/development.html#code-format
1521
steps:
16-
- uses: actions/checkout@v6
22+
- uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.head_ref }}
25+
fetch-depth: 0
1726
- name: Set up Python
1827
uses: actions/setup-python@v6
1928
with:
@@ -31,23 +40,11 @@ jobs:
3140
run: |
3241
git status
3342
git diff
34-
- name: Commit and push the changes if there are any
35-
uses: EndBug/add-and-commit@v9
43+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
44+
git config --local user.name "github-actions[bot]"
45+
git commit -a -m "${GIT_COMMIT_MESSAGE}" || echo "No changes to commit"
46+
- name: Push changes
47+
uses: ad-m/github-push-action@master
3648
with:
37-
author_name: GitHub Actions Bot
38-
author_email: github-actions[bot]@users.noreply.github.com
39-
message: |
40-
Format with ruff
41-
42-
See https://icalendar.readthedocs.io/en/stable/contribute/development.html#code-format
43-
44-
# The way the action should handle pathspec errors from the add and remove commands. Three options are available:
45-
# - ignore -> errors will be logged but the step won't fail
46-
# - exitImmediately -> the action will stop right away, and the step will fail
47-
# - exitAtEnd -> the action will go on, every pathspec error will be logged at the end, the step will fail.
48-
# Default: ignore
49-
pathspec_error_handling: ignore
50-
51-
# Whether to push the commit and, if any, its tags to the repo. It can also be used to set the git push arguments (see the paragraph below for more info)
52-
# Default: true
53-
push: true
49+
github_token: ${{ secrets.GITHUB_TOKEN }}
50+
branch: ${{ github.head_ref }}

0 commit comments

Comments
 (0)