Skip to content

Commit b86607c

Browse files
tj-devel709TJ Lambert
andauthored
Try only changing priority if set by bot (#133)
Co-authored-by: TJ Lambert <[email protected]>
1 parent 942e2c4 commit b86607c

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/prioritize-by-reactions.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Prioritize Issues by Reactions
22

33
on:
4-
schedule:
5-
- cron: '*/10 * * * *' # Runs every 10 mins
4+
# schedule:
5+
# - cron: '*/10 * * * *' # Runs every 10 mins
66
workflow_dispatch: # Allows manual runs
77

88
jobs:
@@ -51,8 +51,17 @@ jobs:
5151
current_priority=$(gh issue view $ISSUE -R $REPO --json labels -q '.labels[].name' | grep '^p/' || echo "")
5252
5353
if [[ "$current_priority" != "$priority" ]]; then
54+
# Check if current priority label was added by github-actions
5455
if [[ -n "$current_priority" ]]; then
55-
echo " ⏹️ Removing old label: $current_priority"
56+
# Get the timeline events to see who added the current priority label
57+
label_added_by=$(gh api repos/$REPO/issues/$ISSUE/timeline --paginate | jq -r --arg label "$current_priority" '.[] | select(.event == "labeled" and .label.name == $label) | .actor.login' | tail -1)
58+
59+
if [[ "$label_added_by" != "github-actions[bot]" ]]; then
60+
echo " 🚫 Priority label '$current_priority' was set by '$label_added_by' (not github-actions), skipping update"
61+
continue
62+
fi
63+
64+
echo " ⏹️ Removing old label: $current_priority (was set by github-actions)"
5665
gh issue edit $ISSUE -R $REPO --remove-label "$current_priority"
5766
fi
5867

0 commit comments

Comments
 (0)