From 819d6989385c67aac42bdd70a308ebc8148b1181 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Tue, 18 Mar 2025 19:14:44 +0100 Subject: [PATCH 1/5] Try fix PR size labeling by conditional --- .github/workflows/pr-auto-manager.yml | 30 +++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pr-auto-manager.yml b/.github/workflows/pr-auto-manager.yml index 52e061840..630b59cbb 100644 --- a/.github/workflows/pr-auto-manager.yml +++ b/.github/workflows/pr-auto-manager.yml @@ -1,7 +1,8 @@ name: πŸ”€ Pull Request Manager on: - pull_request_target: + workflow_dispatch: + pull_request: # TODO: This is for texting, and should not be merged into staging. Staging should use 'pull_request_target' types: [opened, synchronize, reopened, edited, labeled, unlabeled, closed] pull_request_review_comment: types: [created] @@ -14,14 +15,16 @@ jobs: label-by-size: name: 🏷️ Label PR by Size runs-on: ubuntu-latest + # Only needs to run when code is changed + if: github.event.action == 'opened' || github.event.action == 'synchronize' steps: - name: Label PR Size # Pull Request Size Labeler # https://github.com/marketplace/actions/pull-request-size-labeler - uses: codelytv/pr-size-labeler@v1.10.1 + uses: codelytv/pr-size-labeler@v1.10.2 with: - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} xs_label: '🟩 ⬀○○○○' xs_max_size: '20' s_label: '🟩 ⬀⬀○○○' @@ -32,7 +35,6 @@ jobs: l_max_size: '1000' xl_label: 'πŸŸ₯ ⬀⬀⬀⬀⬀' fail_if_xl: 'false' - github_api_url: 'https://api.github.com' files_to_ignore: | "package-lock.json" "public/lib/*" @@ -40,8 +42,8 @@ jobs: label-by-branches: name: 🏷️ Label PR by Branches runs-on: ubuntu-latest - # Only label once when PR is created or branches are changed, to allow manual label removal - if: github.event.action == 'opened' || (github.event.action == 'synchronize' && (github.event.changes.base || github.event.changes.head)) + # Only label once when PR is created or when base branch is changed, to allow manual label removal + if: github.event.action == 'opened' || (github.event.action == 'synchronize' && github.event.changes.base) steps: - name: Checkout Repository @@ -55,11 +57,13 @@ jobs: uses: actions/labeler@v5.0.0 with: configuration-path: .github/pr-auto-labels-by-branch.yml - repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} label-by-files: name: 🏷️ Label PR by Files runs-on: ubuntu-latest + # Only needs to run when code is changed + if: github.event.action == 'opened' || github.event.action == 'synchronize' steps: - name: Checkout Repository @@ -73,12 +77,12 @@ jobs: uses: actions/labeler@v5.0.0 with: configuration-path: .github/pr-auto-labels-by-files.yml - repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} remove-stale-label: name: πŸ—‘οΈ Remove Stale Label on Comment runs-on: ubuntu-latest - # Only runs when this is not done by the github actions bot + # Only runs on comments not done by the github actions bot if: github.event_name == 'pull_request_review_comment' && github.actor != 'github-actions[bot]' steps: @@ -88,7 +92,7 @@ jobs: uses: actions-cool/issues-helper@v3.6.0 with: actions: 'remove-labels' - token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.pull_request.number }} labels: '⚰️ Stale' @@ -161,7 +165,7 @@ jobs: uses: peaceiris/actions-label-commenter@v1.10.0 with: config_file: .github/pr-auto-comments.yml - github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} # This runs on merged PRs to staging, reading the PR body and directly linked issues. Check `issues-updates-on-merge.yml`:`update-linked-issues` for commit-based updates. update-linked-issues: @@ -182,7 +186,7 @@ jobs: PR_NUMBER=${{ github.event.pull_request.number }} REPO=${{ github.repository }} API_URL="https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/issues" - ISSUES=$(curl -s -H "Authorization: token ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}" "$API_URL" | jq -r '.[].number' | jq -R -s -c 'split("\n")[:-1]') + ISSUES=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$API_URL" | jq -r '.[].number' | jq -R -s -c 'split("\n")[:-1]') echo "linked_issues=$ISSUES" >> $GITHUB_ENV - name: Merge Issue Lists @@ -194,7 +198,7 @@ jobs: - name: Label Linked Issues id: label_linked_issues env: - GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | for ISSUE in $(echo $final_issues | jq -r '.[]'); do gh issue edit $ISSUE -R ${{ github.repository }} --add-label "βœ… Done (staging)" From 490aa991d26d1f4b83ae158c6410e91dbb1302d1 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Tue, 18 Mar 2025 19:24:07 +0100 Subject: [PATCH 2/5] Maybe it's a permissions issue --- .github/workflows/pr-auto-manager.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/pr-auto-manager.yml b/.github/workflows/pr-auto-manager.yml index 630b59cbb..68078e732 100644 --- a/.github/workflows/pr-auto-manager.yml +++ b/.github/workflows/pr-auto-manager.yml @@ -18,6 +18,12 @@ jobs: # Only needs to run when code is changed if: github.event.action == 'opened' || github.event.action == 'synchronize' + # Override permissions, the labeler needs issues write access + permissions: + contents: read + issues: write + pull-requests: write + steps: - name: Label PR Size # Pull Request Size Labeler From 68965d0791ca9ff4d185c6b809f23026b63611fb Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Tue, 18 Mar 2025 19:45:02 +0100 Subject: [PATCH 3/5] Update auto labeling - Fix labeling of issues not using word boundaries - Add new PR by branch name labels --- .github/issues-auto-labels.yml | 4 ++-- .github/pr-auto-labels-by-branch.yml | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/issues-auto-labels.yml b/.github/issues-auto-labels.yml index 8bfb62009..8ffe35025 100644 --- a/.github/issues-auto-labels.yml +++ b/.github/issues-auto-labels.yml @@ -14,7 +14,7 @@ - '(🐧 Linux)' 🦊 Firefox: - - '(firefox|mozilla)' + - '\b(firefox|mozilla)\b' πŸ“± Mobile: - - '(iphone|ios|android|πŸ“± Termux)' + - '\b(iphone|ios|android|πŸ“± Termux)\b' diff --git a/.github/pr-auto-labels-by-branch.yml b/.github/pr-auto-labels-by-branch.yml index bbb91d760..3beae0aeb 100644 --- a/.github/pr-auto-labels-by-branch.yml +++ b/.github/pr-auto-labels-by-branch.yml @@ -34,6 +34,9 @@ 🦊 Firefox: - head-branch: ['\bfirefox\b'] +πŸ§‘β€πŸ€β€πŸ§‘ Group Chat: +- head-branch: ['\bgroups?\b'] + πŸ–ΌοΈ Image Gen: - head-branch: ['\bimage-gen\b'] @@ -58,6 +61,9 @@ πŸ“œ Prompt: - head-branch: ['\bprompt\b'] +🧠 Reasoning: +- head-branch: ['\breasoning\b', '\breason\b', '\bthinking\b'] + 🚚 Refactor: - head-branch: ['\brefactor(s|ed)?\b'] From 8d37f9f38c4f63b19a9bb4008e46d6d1ccd05b3e Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Tue, 18 Mar 2025 19:48:04 +0100 Subject: [PATCH 4/5] Replace workflow secrets with automatic secret --- .github/workflows/issues-auto-manager.yml | 14 +++++++------- .github/workflows/issues-updates-on-merge.yml | 2 +- .github/workflows/job-close-stale.yml | 6 +++--- .github/workflows/on-close-handler.yml | 2 +- .github/workflows/on-open-handler.yml | 2 +- .github/workflows/pr-check-merge-conflicts.yaml | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/issues-auto-manager.yml b/.github/workflows/issues-auto-manager.yml index d15ae1add..34be9c2ae 100644 --- a/.github/workflows/issues-auto-manager.yml +++ b/.github/workflows/issues-auto-manager.yml @@ -32,7 +32,7 @@ jobs: with: configuration-path: .github/issues-auto-labels.yml enable-versioned-regex: 0 - repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} label-on-labels: name: 🏷️ Label Issues by Labels @@ -46,7 +46,7 @@ jobs: uses: actions-cool/issues-helper@v3.6.0 with: actions: 'add-labels' - token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} labels: 'πŸ‘ Approved' - name: ❌ Remove progress labels when issue is marked done or stale @@ -56,7 +56,7 @@ jobs: uses: actions-cool/issues-helper@v3.6.0 with: actions: 'remove-labels' - token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} labels: 'πŸ§‘β€πŸ’» In Progress,πŸ€” Unsure,πŸ€” Under Consideration' - name: ❌ Remove temporary labels when confirmed labels are added @@ -66,7 +66,7 @@ jobs: uses: actions-cool/issues-helper@v3.6.0 with: actions: 'remove-labels' - token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} labels: 'πŸ€” Unsure,πŸ€” Under Consideration' - name: ❌ Remove no bug labels when "πŸͺ² Confirmed" is added @@ -76,7 +76,7 @@ jobs: uses: actions-cool/issues-helper@v3.6.0 with: actions: 'remove-labels' - token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} labels: 'βœ–οΈ Not Reproducible,βœ–οΈ Not A Bug' remove-stale-label: @@ -92,7 +92,7 @@ jobs: uses: actions-cool/issues-helper@v3.6.0 with: actions: 'remove-labels' - token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} labels: '⚰️ Stale,πŸ•ΈοΈ Inactive,🚏 Awaiting User Response,πŸ›‘ No Response' @@ -113,4 +113,4 @@ jobs: uses: peaceiris/actions-label-commenter@v1.10.0 with: config_file: .github/issues-auto-comments.yml - github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/issues-updates-on-merge.yml b/.github/workflows/issues-updates-on-merge.yml index 3a5b9a152..3efc9b37f 100644 --- a/.github/workflows/issues-updates-on-merge.yml +++ b/.github/workflows/issues-updates-on-merge.yml @@ -31,7 +31,7 @@ jobs: - name: Label Linked Issues id: label_linked_issues env: - GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | for ISSUE in $(echo $issues | jq -r '.[]'); do if [ "${{ github.ref }}" == "refs/heads/staging" ]; then diff --git a/.github/workflows/job-close-stale.yml b/.github/workflows/job-close-stale.yml index 9b83a6fa0..f3f569679 100644 --- a/.github/workflows/job-close-stale.yml +++ b/.github/workflows/job-close-stale.yml @@ -22,7 +22,7 @@ jobs: # https://github.com/marketplace/actions/close-stale-issues uses: actions/stale@v9.1.0 with: - repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-stale: 183 days-before-close: 7 operations-per-run: 30 @@ -56,7 +56,7 @@ jobs: # https://github.com/marketplace/actions/close-stale-issues uses: actions/stale@v9.1.0 with: - repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-stale: 7 days-before-close: 7 operations-per-run: 30 @@ -83,7 +83,7 @@ jobs: # https://github.com/marketplace/actions/close-stale-issues uses: actions/stale@v9.1.0 with: - repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-stale: 7 days-before-close: 7 operations-per-run: 30 diff --git a/.github/workflows/on-close-handler.yml b/.github/workflows/on-close-handler.yml index c132e558a..501458a2c 100644 --- a/.github/workflows/on-close-handler.yml +++ b/.github/workflows/on-close-handler.yml @@ -23,6 +23,6 @@ jobs: uses: actions-cool/issues-helper@v3.6.0 with: actions: remove-labels - token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} labels: '🚏 Awaiting User Response,πŸ§‘β€πŸ’» In Progress,πŸ“Œ Keep Open,🚫 Merge Conflicts,πŸ”¬ Needs Testing,πŸ”¨ Needs Work,⚰️ Stale,β›” Waiting For External/Upstream' diff --git a/.github/workflows/on-open-handler.yml b/.github/workflows/on-open-handler.yml index df109f914..e5c26d344 100644 --- a/.github/workflows/on-open-handler.yml +++ b/.github/workflows/on-open-handler.yml @@ -24,6 +24,6 @@ jobs: uses: actions-cool/issues-helper@v3.6.0 with: actions: 'add-labels' - token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} labels: 'πŸ‘· Maintainer' diff --git a/.github/workflows/pr-check-merge-conflicts.yaml b/.github/workflows/pr-check-merge-conflicts.yaml index 6c5acebc3..8c48d8915 100644 --- a/.github/workflows/pr-check-merge-conflicts.yaml +++ b/.github/workflows/pr-check-merge-conflicts.yaml @@ -23,6 +23,6 @@ jobs: uses: eps1lon/actions-label-merge-conflict@v3.0.3 with: dirtyLabel: '🚫 Merge Conflicts' - repoToken: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + repoToken: ${{ secrets.GITHUB_TOKEN }} commentOnDirty: > ⚠️ This PR has conflicts that need to be resolved before it can be merged. From 5bda6eac13835b033ea4cda27475ac0de3676e26 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Tue, 18 Mar 2025 19:49:30 +0100 Subject: [PATCH 5/5] Switch pr workflow back to pull_request_target --- .github/workflows/pr-auto-manager.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-auto-manager.yml b/.github/workflows/pr-auto-manager.yml index 68078e732..65314f94b 100644 --- a/.github/workflows/pr-auto-manager.yml +++ b/.github/workflows/pr-auto-manager.yml @@ -1,8 +1,7 @@ name: πŸ”€ Pull Request Manager on: - workflow_dispatch: - pull_request: # TODO: This is for texting, and should not be merged into staging. Staging should use 'pull_request_target' + pull_request_target: types: [opened, synchronize, reopened, edited, labeled, unlabeled, closed] pull_request_review_comment: types: [created] @@ -91,6 +90,12 @@ jobs: # Only runs on comments not done by the github actions bot if: github.event_name == 'pull_request_review_comment' && github.actor != 'github-actions[bot]' + # Override permissions, issue labeler needs issues write access + permissions: + contents: read + issues: write + pull-requests: write + steps: - name: Remove Stale Label # πŸ€– Issues Helper