From 58d53c7a6b7a32172a2f4570cbf4db6d22aaf8e8 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Wed, 16 Jul 2025 14:49:34 +0100 Subject: [PATCH 1/3] test (#3963) # Description of Changes --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. --- .github/workflows/PR-Auto-Deploy-V2.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/PR-Auto-Deploy-V2.yml b/.github/workflows/PR-Auto-Deploy-V2.yml index 98d60c904..95510da37 100644 --- a/.github/workflows/PR-Auto-Deploy-V2.yml +++ b/.github/workflows/PR-Auto-Deploy-V2.yml @@ -34,8 +34,9 @@ jobs: echo "PR Title: $PR_TITLE" echo "PR Author: $PR_AUTHOR" echo "PR Branch: $PR_BRANCH" + echo "PR Base Branch: ${{ github.event.pull_request.base.ref }}" - # Check if author is authorized + # Define authorized users authorized_users=( "Frooodle" "sf298" @@ -47,6 +48,7 @@ jobs: "ConnorYoh" ) + # Check if author is in the authorized list is_authorized=false for user in "${authorized_users[@]}"; do if [[ "$PR_AUTHOR" == "$user" ]]; then @@ -55,19 +57,26 @@ jobs: fi done - # Check if title contains V2/version2 keywords (case insensitive) + # If PR is targeting feature/react-overhaul and user is authorized, deploy unconditionally + PR_BASE_BRANCH="${{ github.event.pull_request.base.ref }}" + if [[ "$PR_BASE_BRANCH" == "feature/react-overhaul" && "$is_authorized" == "true" ]]; then + echo "✅ Deployment forced: PR targets feature/react-overhaul and author is authorized." + echo "should_deploy=true" >> $GITHUB_OUTPUT + exit 0 + fi + + # Otherwise, continue with original keyword checks has_v2_keyword=false if [[ "$PR_TITLE" =~ [Vv]2 ]] || [[ "$PR_TITLE" =~ [Vv]ersion.?2 ]] || [[ "$PR_TITLE" =~ [Vv]ersion.?[Tt]wo ]]; then has_v2_keyword=true fi - # Check if branch name contains V2 or react keywords (case insensitive) has_branch_keyword=false if [[ "$PR_BRANCH" =~ [Vv]2 ]] || [[ "$PR_BRANCH" =~ [Rr]eact ]]; then has_branch_keyword=true fi - if [[ "$is_authorized" == "true" ]] && [[ "$has_v2_keyword" == "true" || "$has_branch_keyword" == "true" ]]; then + if [[ "$is_authorized" == "true" && ( "$has_v2_keyword" == "true" || "$has_branch_keyword" == "true" ) ]]; then echo "✅ Deployment conditions met" echo "should_deploy=true" >> $GITHUB_OUTPUT else From 80e425926efa317655383f57431e4b05aa1baa62 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com.> Date: Wed, 16 Jul 2025 15:14:03 +0100 Subject: [PATCH 2/3] PR auto deploy --- .github/workflows/PR-Auto-Deploy-V2.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/PR-Auto-Deploy-V2.yml b/.github/workflows/PR-Auto-Deploy-V2.yml index 95510da37..b01642cc7 100644 --- a/.github/workflows/PR-Auto-Deploy-V2.yml +++ b/.github/workflows/PR-Auto-Deploy-V2.yml @@ -120,9 +120,11 @@ jobs: with: egress-policy: audit - - name: Generate GitHub App Token - id: generate-token - uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 + - name: Setup GitHub App Bot + if: github.actor != 'dependabot[bot]' + id: setup-bot + uses: ./.github/actions/setup-bot + continue-on-error: true with: app-id: ${{ secrets.GH_APP_ID }} private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} @@ -131,7 +133,7 @@ jobs: id: deployment-started uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: - github-token: ${{ steps.generate-token.outputs.token }} + github-token: ${{ steps.setup-bot.outputs.token }} script: | const { owner, repo } = context.repo; const prNumber = ${{ needs.check-pr.outputs.pr_number }}; @@ -281,7 +283,7 @@ jobs: if: success() uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: - github-token: ${{ steps.generate-token.outputs.token }} + github-token: ${{ steps.setup-bot.outputs.token }} script: | const { owner, repo } = context.repo; const prNumber = ${{ needs.check-pr.outputs.pr_number }}; From 584e2ecee7b34baf9dcb7795e5ca6b91b197c4c8 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com.> Date: Wed, 16 Jul 2025 15:20:02 +0100 Subject: [PATCH 3/3] PR extra --- .github/workflows/PR-Auto-Deploy-V2.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/PR-Auto-Deploy-V2.yml b/.github/workflows/PR-Auto-Deploy-V2.yml index b01642cc7..d8df89585 100644 --- a/.github/workflows/PR-Auto-Deploy-V2.yml +++ b/.github/workflows/PR-Auto-Deploy-V2.yml @@ -120,6 +120,12 @@ jobs: with: egress-policy: audit + - name: Checkout main repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: ${{ github.repository }} + ref: main + - name: Setup GitHub App Bot if: github.actor != 'dependabot[bot]' id: setup-bot