-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a9dbfe
commit e412c2e
Showing
3 changed files
with
39 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,44 +58,3 @@ jobs: | |
|
||
- name: Unit Test | ||
run: bun test | ||
|
||
js-cs-fixer: | ||
if: github.event_name == 'pull_request' && ! startsWith(github.ref, 'refs/heads/auto-fixed/') | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install bun | ||
uses: oven-sh/setup-bun@v1 | ||
|
||
- name: Install Dependencies | ||
run: bun install | ||
|
||
- name: Prepare Git User | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "[email protected]" | ||
git checkout -B "${{ env.FIXER_BRANCH }}" | ||
- name: Apply auto-fixers | ||
run: bun run lint:fix | ||
|
||
- name: Create Fixer PR | ||
run: | | ||
if [[ -z $(git status --porcelain) ]]; then | ||
echo "Nothing to fix... Exiting." | ||
exit 0 | ||
fi | ||
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"` | ||
OPEN_FIXER_PRS=`echo ${OPEN_PRS} | grep -o "\"ref\": \"${{ env.FIXER_BRANCH }}\"" | wc -l` | ||
git commit -am "${{ env.TITLE }}" | ||
git push origin "${{ env.FIXER_BRANCH }}" --force | ||
if [ ${OPEN_FIXER_PRS} -eq "0" ]; then | ||
curl -X POST \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
"https://api.github.com/repos/$GITHUB_REPOSITORY/pulls" \ | ||
-d "{ \"head\":\"${{ env.FIXER_BRANCH }}\", \"base\":\"${{ env.SOURCE_BRANCH }}\", \"title\":\"${{ env.TITLE }}\", \"body\":\"${{ env.DESCRIPTION }}\n\nTriggered by #${{ env.PR_NUMBER }}\" }" | ||
fi | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters