Skip to content

Commit 61fb260

Browse files
authored
Fix label removal on unassigment (#13155)
1 parent 2340398 commit 61fb260

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

.github/workflows/on-issue-unassigned.yml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,27 @@ on:
66
- unassigned
77

88
jobs:
9-
ensure_column:
9+
columns_and_labels:
1010
if: ${{ github.repository_owner == 'JabRef' }}
1111
runs-on: ubuntu-latest
1212
permissions:
1313
issues: write
14+
contents: read
1415
steps:
16+
- name: Check assignees
17+
id: check_assignee
18+
run: |
19+
issue=$(gh issue view ${{ github.event.issue.number }} --json assignees)
20+
count=$(echo "$issue" | jq '.assignees | length')
21+
if [ "$count" -gt 0 ]; then
22+
echo "assigned=yes" >> $GITHUB_OUTPUT
23+
else
24+
echo "assigned=no" >> $GITHUB_OUTPUT
25+
fi
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1528
- name: Move Issue to "Free to take" Column in "Candidates for University Projects"
29+
if: steps.check_assignee.outputs.assigned == 'no'
1630
uses: m7kvqbe1/github-action-move-issues@main
1731
with:
1832
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
@@ -23,6 +37,7 @@ jobs:
2337
default-column: "Free to take"
2438
skip-if-not-in-project: true
2539
- name: Move Issue to "Free to take" Column in "Good First Issues"
40+
if: steps.check_assignee.outputs.assigned == 'no'
2641
uses: m7kvqbe1/github-action-move-issues@main
2742
with:
2843
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
@@ -32,19 +47,16 @@ jobs:
3247
ignored-columns: ""
3348
default-column: "Free to take"
3449
skip-if-not-in-project: true
35-
remove_labels:
36-
if: ${{ github.repository_owner == 'JabRef' }}
37-
runs-on: ubuntu-latest
38-
permissions:
39-
issues: write
40-
contents: read
41-
steps:
4250
- uses: actions/checkout@v4
43-
- name: Remove assigned label
44-
run: gh issue edit ${{ github.event.issue.number }} --remove-label "📍 Assigned"
45-
env:
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
- name: Remove FirstTimeCodeContribution label
48-
run: gh issue edit ${{ github.event.issue.number }} --remove-label "FirstTimeCodeContribution"
51+
if: steps.check_assignee.outputs.assigned == 'no'
52+
- name: Remove labels assigned, reminder-sent, pinned, and "FirstTimeCodeContribution"
53+
if: steps.check_assignee.outputs.assigned == 'no'
54+
run: |
55+
set -e
56+
57+
gh issue edit ${{ github.event.issue.number }} --remove-label "📍 Assigned"
58+
gh issue edit ${{ github.event.issue.number }} --remove-label "🔔 reminder-sent"
59+
gh issue edit ${{ github.event.issue.number }} --remove-label "📌 Pinned"
60+
gh issue edit ${{ github.event.issue.number }} --remove-label "FirstTimeCodeContribution"
4961
env:
5062
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/on-pr-closed.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,6 @@ jobs:
8686
gh issue edit ${{ needs.determine_issue_number.outputs.issue_number }} --remove-label "FirstTimeCodeContribution"
8787
env:
8888
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89-
- name: Remove label pinned (to enable automated pinging and unassignment with a message)
90-
if: steps.check_assignee.outputs.assigned == 'yes'
91-
run: |
92-
set -e
93-
94-
gh issue edit ${{ needs.determine_issue_number.outputs.issue_number }} --remove-label "📌 Pinned"
95-
env:
96-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9789
- name: Move issue to "Free to take" in "Good First Issues"
9890
if: steps.check_assignee.outputs.assigned == 'no'
9991
uses: m7kvqbe1/github-action-move-issues/@add-issue-parameter

0 commit comments

Comments
 (0)