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 @@
1name: πŸ”€ Pull Request Manager1name: πŸ”€ Pull Request Manager
22
3on:3on:
4 pull_request_target:4 workflow_dispatch:
5 pull_request: # TODO: This is for texting, and should not be merged into staging. Staging should use 'pull_request_target'
5 types: [opened, synchronize, reopened, edited, labeled, unlabeled, closed]6 types: [opened, synchronize, reopened, edited, labeled, unlabeled, closed]
6 pull_request_review_comment:7 pull_request_review_comment:
7 types: [created]8 types: [created]
@@ -14,14 +15,16 @@ jobs:
14 label-by-size:15 label-by-size:
15 name: 🏷️ Label PR by Size16 name: 🏷️ Label PR by Size
16 runs-on: ubuntu-latest17 runs-on: ubuntu-latest
18 # Only needs to run when code is changed
19 if: github.event.action == 'opened' || github.event.action == 'synchronize'
1720
18 steps:21 steps:
19 - name: Label PR Size22 - name: Label PR Size
20 # Pull Request Size Labeler23 # Pull Request Size Labeler
21 # https://github.com/marketplace/actions/pull-request-size-labeler24 # https://github.com/marketplace/actions/pull-request-size-labeler
22 uses: codelytv/pr-size-labeler@v1.10.125 uses: codelytv/pr-size-labeler@v1.10.2
23 with:26 with:
24 GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}27 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 xs_label: '🟩 ⬀○○○○'28 xs_label: '🟩 ⬀○○○○'
26 xs_max_size: '20'29 xs_max_size: '20'
27 s_label: '🟩 ⬀⬀○○○'30 s_label: '🟩 ⬀⬀○○○'
@@ -32,7 +35,6 @@ jobs:
32 l_max_size: '1000'35 l_max_size: '1000'
33 xl_label: 'πŸŸ₯ ⬀⬀⬀⬀⬀'36 xl_label: 'πŸŸ₯ ⬀⬀⬀⬀⬀'
34 fail_if_xl: 'false'37 fail_if_xl: 'false'
35 github_api_url: 'https://api.github.com'
36 files_to_ignore: |38 files_to_ignore: |
37 "package-lock.json"39 "package-lock.json"
38 "public/lib/*"40 "public/lib/*"
@@ -40,8 +42,8 @@ jobs:
40 label-by-branches:42 label-by-branches:
41 name: 🏷️ Label PR by Branches43 name: 🏷️ Label PR by Branches
42 runs-on: ubuntu-latest44 runs-on: ubuntu-latest
43 # Only label once when PR is created or branches are changed, to allow manual label removal45 # Only label once when PR is created or when base branch is changed, to allow manual label removal
44 if: github.event.action == 'opened' || (github.event.action == 'synchronize' && (github.event.changes.base || github.event.changes.head))46 if: github.event.action == 'opened' || (github.event.action == 'synchronize' && github.event.changes.base)
4547
46 steps:48 steps:
47 - name: Checkout Repository49 - name: Checkout Repository
@@ -55,11 +57,13 @@ jobs:
55 uses: actions/labeler@v5.0.057 uses: actions/labeler@v5.0.0
56 with:58 with:
57 configuration-path: .github/pr-auto-labels-by-branch.yml59 configuration-path: .github/pr-auto-labels-by-branch.yml
58 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}60 repo-token: ${{ secrets.GITHUB_TOKEN }}
5961
60 label-by-files:62 label-by-files:
61 name: 🏷️ Label PR by Files63 name: 🏷️ Label PR by Files
62 runs-on: ubuntu-latest64 runs-on: ubuntu-latest
65 # Only needs to run when code is changed
66 if: github.event.action == 'opened' || github.event.action == 'synchronize'
6367
64 steps:68 steps:
65 - name: Checkout Repository69 - name: Checkout Repository
@@ -73,12 +77,12 @@ jobs:
73 uses: actions/labeler@v5.0.077 uses: actions/labeler@v5.0.0
74 with:78 with:
75 configuration-path: .github/pr-auto-labels-by-files.yml79 configuration-path: .github/pr-auto-labels-by-files.yml
76 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}80 repo-token: ${{ secrets.GITHUB_TOKEN }}
7781
78 remove-stale-label:82 remove-stale-label:
79 name: πŸ—‘οΈ Remove Stale Label on Comment83 name: πŸ—‘οΈ Remove Stale Label on Comment
80 runs-on: ubuntu-latest84 runs-on: ubuntu-latest
81 # Only runs when this is not done by the github actions bot85 # Only runs on comments not done by the github actions bot
82 if: github.event_name == 'pull_request_review_comment' && github.actor != 'github-actions[bot]'86 if: github.event_name == 'pull_request_review_comment' && github.actor != 'github-actions[bot]'
8387
84 steps:88 steps:
@@ -88,7 +92,7 @@ jobs:
88 uses: actions-cool/issues-helper@v3.6.092 uses: actions-cool/issues-helper@v3.6.0
89 with:93 with:
90 actions: 'remove-labels'94 actions: 'remove-labels'
91 token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}95 token: ${{ secrets.GITHUB_TOKEN }}
92 issue-number: ${{ github.event.pull_request.number }}96 issue-number: ${{ github.event.pull_request.number }}
93 labels: '⚰️ Stale'97 labels: '⚰️ Stale'
9498
@@ -161,7 +165,7 @@ jobs:
161 uses: peaceiris/actions-label-commenter@v1.10.0165 uses: peaceiris/actions-label-commenter@v1.10.0
162 with:166 with:
163 config_file: .github/pr-auto-comments.yml167 config_file: .github/pr-auto-comments.yml
164 github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}168 github_token: ${{ secrets.GITHUB_TOKEN }}
165169
166 # 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.170 # 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.
167 update-linked-issues:171 update-linked-issues:
@@ -182,7 +186,7 @@ jobs:
182 PR_NUMBER=${{ github.event.pull_request.number }}186 PR_NUMBER=${{ github.event.pull_request.number }}
183 REPO=${{ github.repository }}187 REPO=${{ github.repository }}
184 API_URL="https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/issues"188 API_URL="https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/issues"
185 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]')189 ISSUES=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$API_URL" | jq -r '.[].number' | jq -R -s -c 'split("\n")[:-1]')
186 echo "linked_issues=$ISSUES" >> $GITHUB_ENV190 echo "linked_issues=$ISSUES" >> $GITHUB_ENV
187191
188 - name: Merge Issue Lists192 - name: Merge Issue Lists
@@ -194,7 +198,7 @@ jobs:
194 - name: Label Linked Issues198 - name: Label Linked Issues
195 id: label_linked_issues199 id: label_linked_issues
196 env:200 env:
197 GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}201 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198 run: |202 run: |
199 for ISSUE in $(echo $final_issues | jq -r '.[]'); do203 for ISSUE in $(echo $final_issues | jq -r '.[]'); do
200 gh issue edit $ISSUE -R ${{ github.repository }} --add-label "βœ… Done (staging)"204 gh issue edit $ISSUE -R ${{ github.repository }} --add-label "βœ… Done (staging)"