Try fix PR size labeling by conditional

819d6989385c67aac42bdd70a308ebc8148b1181

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +17 -13Showing whitespace changes
.github/workflows/pr-auto-manager.yml+17 -13
@@ -1,7 +1,8 @@
11name: 🔀 Pull Request Manager
22
33on:
44 pull_request_targetworkflow_dispatch:
5+ pull_request: # TODO: This is for texting, and should not be merged into staging. Staging should use 'pull_request_target'
56 types: [opened, synchronize, reopened, edited, labeled, unlabeled, closed]
67 pull_request_review_comment:
78 types: [created]
@@ -14,14 +15,16 @@ jobs:
1415 label-by-size:
1516 name: 🏷️ Label PR by Size
1617 runs-on: ubuntu-latest
18+ # Only needs to run when code is changed
19+ if: github.event.action == 'opened' || github.event.action == 'synchronize'
1720
1821 steps:
1922 - name: Label PR Size
2023 # Pull Request Size Labeler
2124 # https://github.com/marketplace/actions/pull-request-size-labeler
2225 uses: codelytv/pr-size-labeler@v1.10.12
2326 with:
2427 GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
2528 xs_label: '🟩 ⬤○○○○'
2629 xs_max_size: '20'
2730 s_label: '🟩 ⬤⬤○○○'
@@ -32,7 +35,6 @@ jobs:
3235 l_max_size: '1000'
3336 xl_label: '🟥 ⬤⬤⬤⬤⬤'
3437 fail_if_xl: 'false'
35- github_api_url: 'https://api.github.com'
3638 files_to_ignore: |
3739 "package-lock.json"
3840 "public/lib/*"
@@ -40,8 +42,8 @@ jobs:
4042 label-by-branches:
4143 name: 🏷️ Label PR by Branches
4244 runs-on: ubuntu-latest
4345 # Only label once when PR is created or brancheswhen arebase branch is changed, to allow manual label removal
4446 if: github.event.action == 'opened' || (github.event.action == 'synchronize' && (github.event.changes.base || github.event.changes.head))
4547
4648 steps:
4749 - name: Checkout Repository
@@ -55,11 +57,13 @@ jobs:
5557 uses: actions/labeler@v5.0.0
5658 with:
5759 configuration-path: .github/pr-auto-labels-by-branch.yml
5860 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
5961
6062 label-by-files:
6163 name: 🏷️ Label PR by Files
6264 runs-on: ubuntu-latest
65+ # Only needs to run when code is changed
66+ if: github.event.action == 'opened' || github.event.action == 'synchronize'
6367
6468 steps:
6569 - name: Checkout Repository
@@ -73,12 +77,12 @@ jobs:
7377 uses: actions/labeler@v5.0.0
7478 with:
7579 configuration-path: .github/pr-auto-labels-by-files.yml
7680 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
7781
7882 remove-stale-label:
7983 name: 🗑️ Remove Stale Label on Comment
8084 runs-on: ubuntu-latest
8185 # Only runs when thison iscomments not done by the github actions bot
8286 if: github.event_name == 'pull_request_review_comment' && github.actor != 'github-actions[bot]'
8387
8488 steps:
@@ -88,7 +92,7 @@ jobs:
8892 uses: actions-cool/issues-helper@v3.6.0
8993 with:
9094 actions: 'remove-labels'
9195 token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
9296 issue-number: ${{ github.event.pull_request.number }}
9397 labels: '⚰️ Stale'
9498
@@ -161,7 +165,7 @@ jobs:
161165 uses: peaceiris/actions-label-commenter@v1.10.0
162166 with:
163167 config_file: .github/pr-auto-comments.yml
164168 github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
165169
166170 # 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.
167171 update-linked-issues:
@@ -182,7 +186,7 @@ jobs:
182186 PR_NUMBER=${{ github.event.pull_request.number }}
183187 REPO=${{ github.repository }}
184188 API_URL="https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/issues"
185189 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]')
186190 echo "linked_issues=$ISSUES" >> $GITHUB_ENV
187191
188192 - name: Merge Issue Lists
@@ -194,7 +198,7 @@ jobs:
194198 - name: Label Linked Issues
195199 id: label_linked_issues
196200 env:
197201 GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
198202 run: |
199203 for ISSUE in $(echo $final_issues | jq -r '.[]'); do
200204 gh issue edit $ISSUE -R ${{ github.repository }} --add-label "✅ Done (staging)"