forked from microsoft/mssql-jdbc
-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (29 loc) · 1.02 KB
/
autoformat.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: "Auto-Format"
on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
jobs:
format:
# Check if the PR is not from a fork
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: prettier
run: npx prettier --write src/**/*.java
- name: Check for modified files
id: git-check
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT
- name: Push changes
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'Peter Evans'
git config --global user.email 'peter-evans@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "Automated changes"
git push