Skip to content

Commit 4d7e8f5

Browse files
committed
fix: issue workflows
1 parent 5c13f35 commit 4d7e8f5

3 files changed

Lines changed: 59 additions & 36 deletions

File tree

.github/workflows/issue-close-require.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,41 @@ on:
55
schedule:
66
- cron: "0 0 * * *"
77

8+
permissions:
9+
issues: write
10+
811
jobs:
912
close-issues:
1013
name: Close issues 🔒
1114
if: github.repository == 'lazarv/react-server'
1215
runs-on: ubuntu-latest
1316
steps:
1417
- name: needs reproduction
15-
uses: actions-cool/issues-helper@v3
16-
with:
17-
actions: "close-issues"
18-
token: ${{ secrets.GITHUB_TOKEN }}
19-
labels: "needs reproduction"
20-
inactive-day: 30
18+
env:
19+
GH_TOKEN: ${{ github.token }}
20+
GH_REPO: ${{ github.repository }}
21+
INACTIVE_DAYS: "30"
22+
LABEL: "needs reproduction"
23+
run: |
24+
cutoff="$(date -u -d "$INACTIVE_DAYS days ago" +%Y-%m-%d)"
25+
issues="$(
26+
gh issue list \
27+
--repo "$GH_REPO" \
28+
--state open \
29+
--label "$LABEL" \
30+
--search "updated:<$cutoff" \
31+
--limit 1000 \
32+
--json number \
33+
--jq '.[].number'
34+
)"
35+
36+
if [ -z "$issues" ]; then
37+
echo "No issues with label '$LABEL' inactive for $INACTIVE_DAYS days."
38+
exit 0
39+
fi
40+
41+
while IFS= read -r issue; do
42+
[ -n "$issue" ] || continue
43+
echo "Closing issue #$issue"
44+
gh issue close "$issue" --repo "$GH_REPO"
45+
done <<< "$issues"

.github/workflows/issue-labeled.yml

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,44 @@ on:
55
issues:
66
types: [labeled]
77

8+
permissions:
9+
issues: write
10+
811
jobs:
912
reply-labeled:
1013
name: Reply to labeled issue 💬
1114
if: github.repository == 'lazarv/react-server'
1215
runs-on: ubuntu-latest
16+
env:
17+
GH_TOKEN: ${{ github.token }}
18+
GH_REPO: ${{ github.repository }}
19+
ISSUE_NUMBER: ${{ github.event.issue.number }}
20+
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
1321
steps:
14-
- name: contribution welcome
15-
if: github.event.label.name == 'contribution welcome' || github.event.label.name == 'help wanted'
16-
uses: actions-cool/issues-helper@v3
17-
with:
18-
actions: "remove-labels"
19-
token: ${{ secrets.GITHUB_TOKEN }}
20-
issue-number: ${{ github.event.issue.number }}
21-
labels: "pending triage, needs reproduction"
22+
- name: remove pending after contribution label
23+
if: (github.event.label.name == 'contribution welcome' || github.event.label.name == 'help wanted') && contains(github.event.issue.labels.*.name, 'pending triage')
24+
run: gh issue edit "$ISSUE_NUMBER" --repo "$GH_REPO" --remove-label "pending triage"
25+
26+
- name: remove reproduction after contribution label
27+
if: (github.event.label.name == 'contribution welcome' || github.event.label.name == 'help wanted') && contains(github.event.issue.labels.*.name, 'needs reproduction')
28+
run: gh issue edit "$ISSUE_NUMBER" --repo "$GH_REPO" --remove-label "needs reproduction"
2229

2330
- name: remove pending
2431
if: contains(github.event.label.description, '(priority)') && contains(github.event.issue.labels.*.name, 'pending triage')
25-
uses: actions-cool/issues-helper@v3
26-
with:
27-
actions: "remove-labels"
28-
token: ${{ secrets.GITHUB_TOKEN }}
29-
issue-number: ${{ github.event.issue.number }}
30-
labels: "pending triage"
32+
run: gh issue edit "$ISSUE_NUMBER" --repo "$GH_REPO" --remove-label "pending triage"
3133

3234
- name: remove enhancement pending
3335
if: "(github.event.label.name == 'enhancement' || contains(github.event.label.description, '(priority)')) && contains(github.event.issue.labels.*.name, 'enhancement: pending triage')"
34-
uses: actions-cool/issues-helper@v3
35-
with:
36-
actions: "remove-labels"
37-
token: ${{ secrets.GITHUB_TOKEN }}
38-
issue-number: ${{ github.event.issue.number }}
39-
labels: "enhancement: pending triage"
36+
run: |
37+
gh issue edit "$ISSUE_NUMBER" --repo "$GH_REPO" --remove-label "enhancement: pending triage"
4038
4139
- name: needs reproduction
4240
if: github.event.label.name == 'needs reproduction'
43-
uses: actions-cool/issues-helper@v3
44-
with:
45-
actions: "create-comment, remove-labels"
46-
token: ${{ secrets.GITHUB_TOKEN }}
47-
issue-number: ${{ github.event.issue.number }}
48-
body: |
49-
Hello @${{ github.event.issue.user.login }}. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository. Issues marked with `needs reproduction` will be closed if they have no activity within 30 days.
50-
labels: "pending triage"
41+
run: |
42+
gh issue comment "$ISSUE_NUMBER" \
43+
--repo "$GH_REPO" \
44+
--body "Hello @$ISSUE_AUTHOR. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository. Issues marked with \`needs reproduction\` will be closed if they have no activity within 30 days."
45+
46+
- name: remove pending after reproduction label
47+
if: github.event.label.name == 'needs reproduction' && contains(github.event.issue.labels.*.name, 'pending triage')
48+
run: gh issue edit "$ISSUE_NUMBER" --repo "$GH_REPO" --remove-label "pending triage"

.github/workflows/lock-closed-issues.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
if: github.repository == 'lazarv/react-server'
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: dessant/lock-threads@v5
17+
- uses: dessant/lock-threads@v6
1818
with:
19-
github-token: ${{ secrets.GITHUB_TOKEN }}
19+
github-token: ${{ github.token }}
2020
issue-inactive-days: "30"
2121
issue-comment: |
2222
This issue has been locked since it has been closed for more than 30 days.

0 commit comments

Comments
 (0)