Skip to content

Commit e2184eb

Browse files
committed
Port of updated github actions
1 parent 19fd88a commit e2184eb

File tree

3 files changed

+30
-52
lines changed

3 files changed

+30
-52
lines changed

.github/workflows/conversation-labels.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ env:
2121
jobs:
2222
conversation_labels:
2323
name: Calculate and update conversation labels of the issue
24-
if: ${{ !github.event.issue.pull_request }} && ${{ github.event.issue.state == 'open' }}
24+
if: ${{ !github.event.issue.pull_request && github.event.issue.state == 'open' }}
2525
runs-on: ubuntu-latest
2626
permissions:
2727
issues: write
Lines changed: 26 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,38 @@
1-
name: Mark Stale Issues
1+
# This workflow utilises an existing implementation (https://github.com/actions/stale) that performs the following actions:
2+
# 1) Adds "stale" label to issues that have "stat:awaiting-response" for more than 30 days meaning that since we don't have enough information we may potentially close such issue
3+
# 2) Closes issues that have been marked as "stale" for more than 30 days
4+
5+
# This affects only Issues but at some point we may also consider rules for PRs
6+
7+
name: Mark or Close Stale Issues
28

39
on:
410
workflow_dispatch:
511
schedule:
612
- cron: '0 0 * * *' # Runs daily at midnight
713

8-
env:
9-
AWAITING-RESPONSE_LABEL: stat:awaiting-response
10-
STALE_LABEL: stale
11-
DAYS_BEFORE_STALE: 60 # 2 months
12-
1314
jobs:
14-
mark_stale:
15-
name: Check and Mark Stale Issues
16-
if: ${{ !github.event.issue.pull_request }} && ${{ github.event.issue.state == 'open' }}
15+
stale:
1716
runs-on: ubuntu-latest
1817
permissions:
1918
issues: write
20-
19+
2120
steps:
22-
- name: Get Issues with Awaiting Response
23-
id: get_issues
24-
run: |
25-
# Get all open issues with awaiting-response label
26-
ISSUES=$(gh issue list --label "${{ env.AWAITING-RESPONSE_LABEL }}" --json number,labels,updatedAt --jq '.[]')
27-
28-
echo "ISSUES=$ISSUES" >> $GITHUB_ENV
29-
30-
- name: Process Issues
31-
run: |
32-
current_time=$(date +%s)
33-
34-
echo "$ISSUES" | while read -r issue; do
35-
# Extract issue details
36-
number=$(echo "$issue" | jq -r .number)
37-
updated_at=$(echo "$issue" | jq -r .updatedAt)
38-
has_stale=$(echo "$issue" | jq -r '.labels[].name | select(. == "stale")' || echo "")
39-
40-
# Convert updated_at to timestamp
41-
updated_time=$(date -d "$updated_at" +%s)
42-
43-
# Calculate days difference
44-
days_diff=$(( (current_time - updated_time) / 86400 ))
45-
46-
# Check if issue should be marked stale
47-
if [[ $days_diff -ge ${{ env.DAYS_BEFORE_STALE }} && -z "$has_stale" ]]; then
48-
echo "Marking issue #$number as stale"
49-
gh issue edit "$number" --add-label "${{ env.STALE_LABEL }}" \
50-
--body-file <(
51-
echo "This issue has been automatically marked as stale because it has been awaiting response for over 2 months without any activity."
52-
echo ""
53-
echo "Please update the issue with any new information or it may be closed in the future."
54-
)
55-
fi
56-
done
57-
env:
58-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59-
GH_REPO: ${{ github.repository }}
21+
- uses: actions/stale@v9
22+
with:
23+
# Only mark issues (not PRs) as stale
24+
any-of-labels: 'stat:awaiting-response'
25+
days-before-stale: 30
26+
days-before-close: 30
27+
stale-issue-label: 'Stale'
28+
stale-issue-message: >
29+
This issue has been automatically marked as stale because it has been awaiting
30+
response for over 30 days without any activity.
6031
32+
Please update the issue with any new information or it may be closed in 30 days.
33+
close-issue-message: >
34+
This issue has been automatically closed because it has been stale for 30 days
35+
without any activity. Feel free to reopen if you have new information to add.
36+
# Prevent the action from marking/closing PRs
37+
days-before-pr-stale: -1
38+
days-before-pr-close: -1

.github/workflows/remove-labels-on-issue-close.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will remove almost all labels from closed issues beside ones that could be relevant for future tracking like: "port:", "type:", "priority:" and "regression"
1+
# This workflow will remove almost all labels from closed issues beside ones that could be relevant for future tracking like: "port:", "type:", "priority:", "regression" and "stat:imported"
22

33
name: Remove labels when issue is closed
44

@@ -19,7 +19,7 @@ jobs:
1919
id: data
2020
run: |
2121
# Convert labels to array and filter out type: labels
22-
LABELS_TO_REMOVE=($(echo "$EXISTING_LABELS" | jq -r '.[] | select(startswith("type:") or startswith("port:") or startswith("priority:") or . == "regression" | not)'))
22+
LABELS_TO_REMOVE=($(echo "$EXISTING_LABELS" | jq -r '.[] | select(startswith("type:") or startswith("port:") or startswith("priority:") or . == "regression" or . == "stat:imported" | not)'))
2323
2424
# Only proceed if we have labels to remove
2525
if [ ${#LABELS_TO_REMOVE[@]} -gt 0 ]; then
@@ -32,7 +32,7 @@ jobs:
3232
EXISTING_LABELS: ${{ toJson(github.event.issue.labels.*.name) }}
3333

3434
- name: Remove labels
35-
if: env.HAS_LABELS == 'true'
35+
if: ${{ env.REMOVE_LABELS != '' }}
3636
run: gh issue edit "$NUMBER" --remove-label "$REMOVE_LABELS"
3737
env:
3838
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)