Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
df23afa
chore: Add action to auto update labels on comments
EmandM Jan 8, 2025
1d2828b
Merge branch 'develop' into chore/add_auto_labeler
NoelStephensUnity Jan 15, 2025
53ec291
Merge branch 'develop' into chore/add_auto_labeler
NoelStephensUnity Feb 5, 2025
0f0b3ab
Merge branch 'develop' of https://github.com/Unity-Technologies/com.u…
EmandM Mar 7, 2025
bbadb74
Update syntax, add on-close action
EmandM Mar 8, 2025
0cd6449
Merge branch 'develop' into chore/add_auto_labeler
EmandM Mar 10, 2025
07b603d
temp
EmandM Mar 12, 2025
b2f53fd
Merge branch 'develop' into chore/add_auto_labeler
NoelStephensUnity Mar 13, 2025
6cbdbb0
Added stat:reply-needed label handling
michalChrobot Mar 18, 2025
d3db9b6
Merge branch 'develop' into chore/add_auto_labeler
michalChrobot Mar 18, 2025
8c10d1d
Added workflow for marking stale issues
michalChrobot Mar 18, 2025
d304910
Added workflow for managing assigning and unassignig from an issue
michalChrobot Mar 18, 2025
8bfb5fc
Added possibility of an manual trigger
michalChrobot Mar 18, 2025
672ed1e
Merge branch 'chore/add_auto_labeler' of https://github.com/Unity-Tec…
michalChrobot Mar 18, 2025
eeaaae1
Added stat:import label to the list of exclusion when deleting labels…
michalChrobot Mar 18, 2025
2921422
Merge branch 'develop' into chore/add_auto_labeler
michalChrobot Mar 18, 2025
58550ef
Comments added and rfc template removed
michalChrobot Mar 18, 2025
e7e9ee9
Merge branch 'develop' into chore/add_auto_labeler
michalChrobot Mar 20, 2025
1c1960a
Merge branch 'develop' into chore/add_auto_labeler
EmandM Mar 31, 2025
2474f90
Merge branch 'develop' into chore/add_auto_labeler
michalChrobot Apr 1, 2025
c78d5b2
Added preimplemented stale GitHub action
michalChrobot Apr 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/ISSUE_TEMPLATE/rfc-tracking-issue.md

This file was deleted.

70 changes: 70 additions & 0 deletions .github/workflows/assignee-management.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This workflow manages issue assignments and related label changes:
# 1. When someone is assigned to an issue:
# - Removes "stat:awaiting-triage" label
# - Adds "stat:Investigating" label
# 2. When all assignees are removed from an issue:
# - Adds "stat:awaiting-triage" label
# - Removes "stat:Investigating" label
# 3. When "stat:Investigating" label is added:
# - Automatically assigns the issue to the person who added the label

name: Handle Issue Assignment and Labels

on:
issues:
types: [assigned, unassigned, labeled]

env:
AWAITING-TRIAGE_LABEL: stat:awaiting-triage
INVESTIGATING_LABEL: stat:Investigating

jobs:
handle_assignment:
name: Handle Issue Assignment Changes
if: ${{ !github.event.issue.pull_request }} && ${{ github.event.issue.state == 'open' }}
runs-on: ubuntu-latest
permissions:
issues: write

steps:
- name: Handle Assignment Changes
run: |
if [[ "${{ github.event.action }}" == "assigned" ]]; then
# Someone was assigned - remove awaiting-triage, add investigating
echo "ADD=${{ env.INVESTIGATING_LABEL }}" >> $GITHUB_ENV
echo "REMOVE=${{ env.AWAITING-TRIAGE_LABEL }}" >> $GITHUB_ENV
elif [[ "${{ github.event.action }}" == "unassigned" ]]; then
# Check if there are any remaining assignees
ASSIGNEES=$(echo '${{ toJson(github.event.issue.assignees) }}' | jq length)
if [[ "$ASSIGNEES" == "0" ]]; then
# No assignees left - add awaiting-triage, remove investigating
echo "ADD=${{ env.AWAITING-TRIAGE_LABEL }}" >> $GITHUB_ENV
echo "REMOVE=${{ env.INVESTIGATING_LABEL }}" >> $GITHUB_ENV
fi
fi

- name: Update Labels
if: env.ADD != '' || env.REMOVE != ''
run: gh issue edit "$NUMBER" --add-label "$ADD" --remove-label "$REMOVE"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}

handle_investigating_label:
name: Handle Investigating Label Addition
if: ${{ github.event.action == 'labeled' && github.event.label.name == 'stat:Investigating' && !github.event.issue.pull_request && github.event.issue.state == 'open' }}
runs-on: ubuntu-latest
permissions:
issues: write

steps:
- name: Assign Issue to person that added Investigating Label
run: |
# Assign the issue to the person who added the label
gh issue edit "$NUMBER" --add-assignee "$ACTOR"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
ACTOR: ${{ github.actor }}
51 changes: 51 additions & 0 deletions .github/workflows/conversation-labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow will update issues with proper "conversation related" labels. This mean that stat:awaiting-repsonse label will be present after Unity account made comments and stat:reply-needed will be present when user made latest comment

name: Update conversation labels of the issue

# Trigger for the workflow
# This trigger will populate the github.event object
# Details on properties are here: https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=created#issue_comment
on:
issue_comment:
types: [created]

concurrency:
group: ${{ github.workflow }}-${{ github.event.issue.number }}
cancel-in-progress: true

# Define labels here
env:
AWAITING_RESPONSE: stat:awaiting-response
REPLY_NEEDED: stat:reply-needed

jobs:
conversation_labels:
name: Calculate and update conversation labels of the issue
if: ${{ !github.event.issue.pull_request }} && ${{ github.event.issue.state == 'open' }}
runs-on: ubuntu-latest
permissions:
issues: write

steps:
- name: Calculate labels
run: |

if [[ "${{ github.event.comment.author_association }}" == "MEMBER" ]]; then
# Unity member commented - add awaiting-response, remove reply-needed
echo "ADD=${{ env.AWAITING_RESPONSE }}" >> $GITHUB_ENV
echo "REMOVE=${{ env.REPLY_NEEDED }}" >> $GITHUB_ENV
else
# Non-Unity member commented - add reply-needed, remove awaiting-response
echo "ADD=${{ env.REPLY_NEEDED }}" >> $GITHUB_ENV
echo "REMOVE=${{ env.AWAITING_RESPONSE }}" >> $GITHUB_ENV
fi

- name: Update labels
# This runs a command using the github cli: https://cli.github.com/manual/gh_issue_edit
# If $ADD is set, it will add the label, otherwise it will remove the label
# There is no need to check if $ADD or $REMOVE is set, as the command will ignore it if it is empty
run: gh issue edit "$NUMBER" --add-label "$ADD" --remove-label "$REMOVE"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
62 changes: 62 additions & 0 deletions .github/workflows/mark-stale-issue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This workflow add "stale" label to issues that have "stat:awaiting-response" for more than 60 days meaning that since we don't have enough information we may potentially close such issue

name: Mark Stale Issues

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight

env:
AWAITING-RESPONSE_LABEL: stat:awaiting-response
STALE_LABEL: stale
DAYS_BEFORE_STALE: 60 # 2 months

jobs:
mark_stale:
name: Check and Mark Stale Issues
if: ${{ !github.event.issue.pull_request }} && ${{ github.event.issue.state == 'open' }}
runs-on: ubuntu-latest
permissions:
issues: write

steps:
- name: Get Issues with Awaiting Response
id: get_issues
run: |
# Get all open issues with awaiting-response label
ISSUES=$(gh issue list --label "${{ env.AWAITING-RESPONSE_LABEL }}" --json number,labels,updatedAt --jq '.[]')

echo "ISSUES=$ISSUES" >> $GITHUB_ENV

- name: Process Issues
run: |
current_time=$(date +%s)

echo "$ISSUES" | while read -r issue; do
# Extract issue details
number=$(echo "$issue" | jq -r .number)
updated_at=$(echo "$issue" | jq -r .updatedAt)
has_stale=$(echo "$issue" | jq -r '.labels[].name | select(. == "stale")' || echo "")

# Convert updated_at to timestamp
updated_time=$(date -d "$updated_at" +%s)

# Calculate days difference
days_diff=$(( (current_time - updated_time) / 86400 ))

# Check if issue should be marked stale
if [[ $days_diff -ge ${{ env.DAYS_BEFORE_STALE }} && -z "$has_stale" ]]; then
echo "Marking issue #$number as stale"
gh issue edit "$number" --add-label "${{ env.STALE_LABEL }}" \
--body-file <(
echo "This issue has been automatically marked as stale because it has been awaiting response for over 2 months without any activity."
echo ""
echo "Please update the issue with any new information or it may be closed in the future."
)
fi
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}

40 changes: 40 additions & 0 deletions .github/workflows/remove-labels-on-issue-close.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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"

name: Remove labels when issue is closed

on:
issues:
types: [closed] # We want it to run on closed issues

jobs:
remove_labels:
name: Calculate and remove issue labels
if: ${{ !github.event.issue.pull_request }} # This is needed to distinguish from PRs (which we don't want to affect)
runs-on: ubuntu-latest
permissions:
issues: write

steps:
- name: Find labels to remove
id: data
run: |
# Convert labels to array and filter out type: labels
LABELS_TO_REMOVE=($(echo "$EXISTING_LABELS" | jq -r '.[] | select(startswith("type:") or startswith("port:") or startswith("priority:") or . == "regression" or . == "stat:imported" | not)'))

# Only proceed if we have labels to remove
if [ ${#LABELS_TO_REMOVE[@]} -gt 0 ]; then
echo "REMOVE_LABELS=$(IFS=,; echo "${LABELS_TO_REMOVE[*]}")" >> $GITHUB_ENV
echo "HAS_LABELS=true" >> $GITHUB_ENV
else
echo "HAS_LABELS=false" >> $GITHUB_ENV
fi
env:
EXISTING_LABELS: ${{ toJson(github.event.issue.labels.*.name) }}

- name: Remove labels
if: env.HAS_LABELS == 'true'
run: gh issue edit "$NUMBER" --remove-label "$REMOVE_LABELS"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}