99 branches :
1010 - main
1111
12- env :
13- PR_NUMBER : ' ${{ github.event.number }}'
14- SOURCE_BRANCH : $GITHUB_HEAD_REF
15- FIXER_BRANCH : auto-fixed/$GITHUB_HEAD_REF
16- TITLE : Apply fixes from JS-CS-Fixer
17- DESCRIPTION : This merge request applies JS code style fixes from an analysis carried out through GitHub Actions.
18-
1912concurrency :
2013 group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
2114 cancel-in-progress : true
2518 steps :
2619 - uses : actions/checkout@v4
2720
28- - name : Install bun
21+ - name : Install Bun
2922 uses : oven-sh/setup-bun@v1
3023
3124 - name : Lint
@@ -36,11 +29,11 @@ jobs:
3629
3730 steps :
3831 - uses : actions/checkout@v4
39-
40- - name : Install bun
32+
33+ - name : Install Bun
4134 uses : oven-sh/setup-bun@v1
4235
43- - name : Install dependencies
36+ - name : Install Dependencies
4437 run : bun install
4538
4639 - name : Typecheck
@@ -50,52 +43,11 @@ jobs:
5043 steps :
5144 - uses : actions/checkout@v4
5245
53- - name : Install bun
46+ - name : Install Bun
5447 uses : oven-sh/setup-bun@v1
5548
5649 - name : Install Dependencies
5750 run : bun install
5851
5952 - name : Unit Test
6053 run : bun test
61-
62- js-cs-fixer :
63- if : github.event_name == 'pull_request' && ! startsWith(github.ref, 'refs/heads/auto-fixed/')
64-
65- steps :
66- - name : Checkout Code
67- uses : actions/checkout@v4
68-
69- - name : Install bun
70- uses : oven-sh/setup-bun@v1
71-
72- - name : Install Dependencies
73- run : bun install
74-
75- - name : Prepare Git User
76- run : |
77- git config --global user.name "github-actions[bot]"
78- git config --global user.email "action@github.com"
79- git checkout -B "${{ env.FIXER_BRANCH }}"
80-
81- - name : Apply auto-fixers
82- run : bun run lint:fix
83-
84- - name : Create Fixer PR
85- run : |
86- if [[ -z $(git status --porcelain) ]]; then
87- echo "Nothing to fix... Exiting."
88- exit 0
89- fi
90- OPEN_PRS=`curl --silent -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls?state=open"`
91- OPEN_FIXER_PRS=`echo ${OPEN_PRS} | grep -o "\"ref\": \"${{ env.FIXER_BRANCH }}\"" | wc -l`
92- git commit -am "${{ env.TITLE }}"
93- git push origin "${{ env.FIXER_BRANCH }}" --force
94- if [ ${OPEN_FIXER_PRS} -eq "0" ]; then
95- curl -X POST \
96- -H "Accept: application/vnd.github.v3+json" \
97- -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
98- "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls" \
99- -d "{ \"head\":\"${{ env.FIXER_BRANCH }}\", \"base\":\"${{ env.SOURCE_BRANCH }}\", \"title\":\"${{ env.TITLE }}\", \"body\":\"${{ env.DESCRIPTION }}\n\nTriggered by #${{ env.PR_NUMBER }}\" }"
100- fi
101- exit 1
0 commit comments