File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Prioritize Issues by Reactions
22
33on :
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
88jobs :
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
You can’t perform that action at this time.
0 commit comments