Skip to content
This repository was archived by the owner on Feb 19, 2024. It is now read-only.

Commit 869cd9f

Browse files
committed
style: auto-format source code in a PR
If using it in an action for existing PRs, changes will not re-trigger other actions
1 parent a10d42e commit 869cd9f

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/code-style.yaml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Ensure source code is properly formatted
22

3-
on: pull_request
3+
on:
4+
push:
5+
branches: [saga]
46

57
permissions:
68
contents: write
@@ -36,13 +38,14 @@ jobs:
3638
- name: Format source code with prettier
3739
run: npx prettier --write ./
3840

39-
- name: Commit changes
40-
run: |
41-
if ! git diff --exit-code --name-only; then
42-
echo "machine github.com login accesskey password ${{ secrets.GITHUB_TOKEN }}" > ~/.netrc
43-
git config --global user.email "[email protected]"
44-
git config --global user.name "github-actions[bot]"
45-
git add -A
46-
git commit -m "style: auto-format source code"
47-
git push origin HEAD:${{ github.event.pull_request.head.ref }}
48-
fi
41+
- name: Create Pull Request
42+
uses: peter-evans/create-pull-request@v4
43+
with:
44+
commit-message: "style: auto-format source code"
45+
committer: "github-actions[bot] <[email protected]>"
46+
author: "github-actions[bot] <[email protected]>"
47+
branch: format-source
48+
delete-branch: true
49+
title: "Auto-format source"
50+
body: "Ensure source code is properly formatted"
51+
labels: enhancement

0 commit comments

Comments
 (0)