Merge pull request #3694 from SillyTavern/workflow-hotfixes Workflow hotfixes

ead37defeb84893e1e1bea1c98e6f9e0c0b53cdb

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
7 files changed, +65 -28Showing whitespace changes
.github/workflows/issues-auto-manager.yml+13 -9
@@ -7,6 +7,10 @@ on:
77 issue_comment:
88 types: [created]
99
10+permissions:
11+ contents: read
12+ issues: write
13+
1014jobs:
1115 label-on-content:
1216 name: 🏷️ Label Issues by Content
@@ -16,7 +20,7 @@ jobs:
1620 - name: Checkout Repository
1721 # Checkout
1822 # https://github.com/marketplace/actions/checkout
1923 uses: actions/checkout@v4.2.2
2024
2125 - name: Auto-Label Issues (Based on Issue Content)
2226 # only auto label based on issue content once, on open (to prevent re-labeling removed labels)
@@ -24,7 +28,7 @@ jobs:
2428
2529 # Issue Labeler
2630 # https://github.com/marketplace/actions/regex-issue-labeler
2731 uses: github/issue-labeler@v3.4
2832 with:
2933 configuration-path: .github/issues-auto-labels.yml
3034 enable-versioned-regex: 0
@@ -39,7 +43,7 @@ jobs:
3943 if: contains(fromJSON('["πŸ‘©β€πŸ’» Good First Issue", "πŸ™ Help Wanted", "πŸͺ² Confirmed", "⚠️ High Priority", "❕ Medium Priority", "πŸ’€ Low Priority"]'), github.event.label.name)
4044 # πŸ€– Issues Helper
4145 # https://github.com/marketplace/actions/issues-helper
4246 uses: actions-cool/issues-helper@v3.6.0
4347 with:
4448 actions: 'add-labels'
4549 token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
@@ -49,7 +53,7 @@ jobs:
4953 if: contains(fromJSON('["βœ… Done", "βœ… Done (staging)", "⚰️ Stale", "❌ wontfix"]'), github.event.label.name)
5054 # πŸ€– Issues Helper
5155 # https://github.com/marketplace/actions/issues-helper
5256 uses: actions-cool/issues-helper@v3.6.0
5357 with:
5458 actions: 'remove-labels'
5559 token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
@@ -59,7 +63,7 @@ jobs:
5963 if: contains(fromJSON('["❌ wontfix","πŸ‘ Approved","πŸ‘©β€πŸ’» Good First Issue"]'), github.event.label.name)
6064 # πŸ€– Issues Helper
6165 # https://github.com/marketplace/actions/issues-helper
6266 uses: actions-cool/issues-helper@v3.6.0
6367 with:
6468 actions: 'remove-labels'
6569 token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
@@ -69,7 +73,7 @@ jobs:
6973 if: github.event.label.name == 'πŸͺ² Confirmed'
7074 # πŸ€– Issues Helper
7175 # https://github.com/marketplace/actions/issues-helper
7276 uses: actions-cool/issues-helper@v3.6.0
7377 with:
7478 actions: 'remove-labels'
7579 token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
@@ -85,7 +89,7 @@ jobs:
8589 - name: Remove Stale Label
8690 # πŸ€– Issues Helper
8791 # https://github.com/marketplace/actions/issues-helper
8892 uses: actions-cool/issues-helper@v3.6.0
8993 with:
9094 actions: 'remove-labels'
9195 token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
@@ -101,12 +105,12 @@ jobs:
101105 - name: Checkout Repository
102106 # Checkout
103107 # https://github.com/marketplace/actions/checkout
104108 uses: actions/checkout@v4.2.2
105109
106110 - name: Post Issue Comments Based on Labels
107111 # Label Commenter
108112 # https://github.com/marketplace/actions/label-commenter
109113 uses: peaceiris/actions-label-commenter@v1.10.0
110114 with:
111115 config_file: .github/issues-auto-comments.yml
112116 github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
.github/workflows/issues-updates-on-merge.yml+6 -2
@@ -6,6 +6,10 @@ on:
66 - staging
77 - release
88
9+permissions:
10+ contents: read
11+ issues: write
12+
913jobs:
1014 # This runs commits to staging/release, reading the commit messages. Check `pr-auto-manager.yml`:`update-linked-issues` for PR-linked updates.
1115 update-linked-issues:
@@ -16,12 +20,12 @@ jobs:
1620 - name: Checkout Repository
1721 # Checkout
1822 # https://github.com/marketplace/actions/checkout
1923 uses: actions/checkout@v4.2.2
2024
2125 - name: Extract Linked Issues from Commit Message
2226 id: extract_issues
2327 run: |
2428 ISSUES=$(git log -1${{ github.event.before }}..${{ github.event.after }} --pretty=%B | grep -oiE '(close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved) #([0-9]+)' | awk '{print $2}' | tr -d '#' | jq -R -s -c 'split("\n")[:-1]')
2529 echo "issues=$ISSUES" >> $GITHUB_ENV
2630
2731 - name: Label Linked Issues
.github/workflows/job-close-stale.yml+8 -3
@@ -6,6 +6,11 @@ on:
66 schedule:
77 - cron: '0 0 * * *' # Runs every day at midnight UTC
88
9+permissions:
10+ contents: read
11+ issues: write
12+ pull-requests: write
13+
914jobs:
1015 mark-inactivity:
1116 name: ⏳ Mark Issues/PRs without Activity
@@ -15,7 +20,7 @@ jobs:
1520 - name: Mark Issues/PRs without Activity
1621 # Close Stale Issues and PRs
1722 # https://github.com/marketplace/actions/close-stale-issues
1823 uses: actions/stale@v9.1.0
1924 with:
2025 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
2126 days-before-stale: 183
@@ -49,7 +54,7 @@ jobs:
4954 - name: Mark Issues/PRs Awaiting User Response
5055 # Close Stale Issues and PRs
5156 # https://github.com/marketplace/actions/close-stale-issues
5257 uses: actions/stale@v9.1.0
5358 with:
5459 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
5560 days-before-stale: 7
@@ -76,7 +81,7 @@ jobs:
7681 - name: Mark Issues with Alternative Exists
7782 # Close Stale Issues and PRs
7883 # https://github.com/marketplace/actions/close-stale-issues
7984 uses: actions/stale@v9.1.0
8085 with:
8186 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
8287 days-before-stale: 7
.github/workflows/on-close-handler.yml+6 -1
@@ -6,6 +6,11 @@ on:
66 pull_request_target:
77 types: [closed]
88
9+permissions:
10+ contents: read
11+ issues: write
12+ pull-requests: write
13+
914jobs:
1015 remove-labels:
1116 name: πŸ—‘οΈ Remove Pending Labels on Close
@@ -15,7 +20,7 @@ jobs:
1520 - name: Remove Pending Labels on Close
1621 # πŸ€– Issues Helper
1722 # https://github.com/marketplace/actions/issues-helper
1823 uses: actions-cool/issues-helper@v3.6.0
1924 with:
2025 actions: remove-labels
2126 token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
.github/workflows/on-open-handler.yml+6 -1
@@ -6,6 +6,11 @@ on:
66 pull_request_target:
77 types: [opened]
88
9+permissions:
10+ contents: read
11+ issues: write
12+ pull-requests: write
13+
914jobs:
1015 label-maintainer:
1116 name: 🏷️ Label if Author is a Repo Maintainer
@@ -16,7 +21,7 @@ jobs:
1621 - name: Label if Author is a Repo Maintainer
1722 # πŸ€– Issues Helper
1823 # https://github.com/marketplace/actions/issues-helper
1924 uses: actions-cool/issues-helper@v3.6.0
2025 with:
2126 actions: 'add-labels'
2227 token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
.github/workflows/pr-auto-manager.yml+21 -11
@@ -6,6 +6,10 @@ on:
66 pull_request_review_comment:
77 types: [created]
88
9+permissions:
10+ contents: read
11+ pull-requests: write
12+
913jobs:
1014 label-by-size:
1115 name: 🏷️ Label PR by Size
@@ -15,7 +19,7 @@ jobs:
1519 - name: Label PR Size
1620 # Pull Request Size Labeler
1721 # https://github.com/marketplace/actions/pull-request-size-labeler
1822 uses: codelytv/pr-size-labeler@v1.10.2
1923 with:
2024 GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
2125 xs_label: '🟩 ⬀○○○○'
@@ -43,12 +47,12 @@ jobs:
4347 - name: Checkout Repository
4448 # Checkout
4549 # https://github.com/marketplace/actions/checkout
4650 uses: actions/checkout@v4.2.2
4751
4852 - name: Apply Labels Based on Branch Name and Target Branch
4953 # Pull Request Labeler
5054 # https://github.com/marketplace/actions/labeler
5155 uses: actions/labeler@v5.0.0
5256 with:
5357 configuration-path: .github/pr-auto-labels-by-branch.yml
5458 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
@@ -61,12 +65,12 @@ jobs:
6165 - name: Checkout Repository
6266 # Checkout
6367 # https://github.com/marketplace/actions/checkout
6468 uses: actions/checkout@v4.2.2
6569
6670 - name: Apply Labels Based on Changed Files
6771 # Pull Request Labeler
6872 # https://github.com/marketplace/actions/labeler
6973 uses: actions/labeler@v5.0.0
7074 with:
7175 configuration-path: .github/pr-auto-labels-by-files.yml
7276 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
@@ -75,13 +79,13 @@ jobs:
7579 name: πŸ—‘οΈ Remove Stale Label on Comment
7680 runs-on: ubuntu-latest
7781 # Only runs when this is not done by the github actions bot
7882 if: github.event_name == 'pull_request_review_comment' && github.actor != 'github-actions[bot]'
7983
8084 steps:
8185 - name: Remove Stale Label
8286 # πŸ€– Issues Helper
8387 # https://github.com/marketplace/actions/issues-helper
8488 uses: actions-cool/issues-helper@v3.6.0
8589 with:
8690 actions: 'remove-labels'
8791 token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
@@ -95,12 +99,18 @@ jobs:
9599 # Run, even if the previous jobs were skipped/failed
96100 if: always()
97101
102+ # Override permissions, as this needs to write a check
103+ permissions:
104+ checks: write
105+ contents: read
106+ pull-requests: read
107+
98108 steps:
99109 - name: Check Merge Blocking
100110 # GitHub Script
101111 # https://github.com/marketplace/actions/github-scriptLabelsscript
102112 id: label-check
103113 uses: actions/github-script@v7.0.1
104114 with:
105115 script: |
106116 const prLabels = context.payload.pull_request.labels.map(label => label.name);
@@ -143,12 +153,12 @@ jobs:
143153 - name: Checkout Repository
144154 # Checkout
145155 # https://github.com/marketplace/actions/checkout
146156 uses: actions/checkout@v4.2.2
147157
148158 - name: Post PR Comments Based on Labels
149159 # Label Commenter for PRs
150160 # https://github.com/marketplace/actions/label-commenter
151161 uses: peaceiris/actions-label-commenter@v1.10.0
152162 with:
153163 config_file: .github/pr-auto-comments.yml
154164 github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
.github/workflows/pr-check-merge-conflicts.yaml+5 -1
@@ -7,6 +7,10 @@ on:
77 pull_request_target:
88 types: [synchronize]
99
10+permissions:
11+ contents: read
12+ pull-requests: write
13+
1014jobs:
1115 check-merge-conflicts:
1216 name: βš”οΈ Check Merge Conflicts
@@ -16,7 +20,7 @@ jobs:
1620 - name: Check Merge Conflicts
1721 # Label Conflicting Pull Requests
1822 # https://github.com/marketplace/actions/label-conflicting-pull-requests
1923 uses: eps1lon/actions-label-merge-conflict@v3.0.3
2024 with:
2125 dirtyLabel: '🚫 Merge Conflicts'
2226 repoToken: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}