From 1760d7f82e8b0bff8475790e65af10a8a57bc10d Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:38:37 +0800 Subject: [PATCH 1/3] Update prettier.yml --- .github/workflows/prettier.yml | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 5b7c696d1..bd79468c8 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -22,13 +22,31 @@ jobs: - name: Run Prettier run: npx -y prettier ./domains -w --tab-width 2 --print-width 120 - - name: Commit - uses: cpina/github-action-push-to-another-repository@main - with: - source-directory: "." - destination-github-username: is-a-dev - destination-repository-name: register - user-email: "bot@is-a.dev" - user-name: "is-a-dev-bot" + - name: Create and switch to new branch + run: | + BRANCH_NAME="prettier-$(date +%s)" + git checkout -b "$BRANCH_NAME" + + - name: Commit changes + run: | + git config --local user.email "bot@is-a.dev" + git config --local user.name "is-a-dev-bot" + git add . + git commit -m "chore: apply Prettier formatting" + + - name: Push changes to new branch env: API_TOKEN_GITHUB: ${{ secrets.BOT }} + run: | + git push -u origin "$BRANCH_NAME" + + - name: Create Pull Request + id: create_pr + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.BOT }} + head: "$BRANCH_NAME" + base: main + title: "$BRANCH_NAME" + body: "Generated from https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}." + auto-merge: true From 040cd6f5bc56e673e1063e350917cd56b02b79f6 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:41:36 +0800 Subject: [PATCH 2/3] Update prettier.yml --- .github/workflows/prettier.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index bd79468c8..c2634b0d1 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -22,25 +22,30 @@ jobs: - name: Run Prettier run: npx -y prettier ./domains -w --tab-width 2 --print-width 120 - - name: Create and switch to new branch + - name: Create branch run: | BRANCH_NAME="prettier-$(date +%s)" + echo "Generated branch name: $BRANCH_NAME" + if [ -z "$BRANCH_NAME" ]; then + echo "Error: Branch name is empty." + exit 1 + fi git checkout -b "$BRANCH_NAME" - - name: Commit changes + - name: Commit run: | git config --local user.email "bot@is-a.dev" git config --local user.name "is-a-dev-bot" git add . - git commit -m "chore: apply Prettier formatting" + git commit -m "chore: apply formatting" - - name: Push changes to new branch + - name: Push env: API_TOKEN_GITHUB: ${{ secrets.BOT }} run: | git push -u origin "$BRANCH_NAME" - - name: Create Pull Request + - name: Create pull request id: create_pr uses: peter-evans/create-pull-request@v5 with: From cef7f280bfcf5362a290b60a5db7c2514ae1e355 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:45:29 +0800 Subject: [PATCH 3/3] Update prettier.yml --- .github/workflows/prettier.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index c2634b0d1..b5f8c496c 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -25,11 +25,8 @@ jobs: - name: Create branch run: | BRANCH_NAME="prettier-$(date +%s)" - echo "Generated branch name: $BRANCH_NAME" - if [ -z "$BRANCH_NAME" ]; then - echo "Error: Branch name is empty." - exit 1 - fi + echo "Generated branch: $BRANCH_NAME" + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV git checkout -b "$BRANCH_NAME" - name: Commit