Skip to content

fix(needs-triage): respect issue label removals - #204

Draft
caugner wants to merge 2 commits into
mainfrom
needs-triage-event-history
Draft

caugner wants to merge 2 commits into
mainfrom
needs-triage-event-history

Conversation

@caugner

@caugner caugner commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

Update the needs-triage workflow to check paginated issue event history before adding the configured label.

  • Skip adding the label only when a matching unlabeled event occurred after the triggering event.

Motivation

Preserve maintainer label removals made while the opened, reopened, or transferred workflow is starting.

Additional details

Use timestamps from the triggering payload: issue.created_at for ordinary opened events, issue.updated_at for reopened and destination opened events after transfer, and changes.new_issue.updated_at for transferred events. Other event types retain the existing add behavior.

Manual validation in mdn/needs-triage-test:

  • An issue without the label and no later removal received needs triage (issue #1).
  • An unlabeled event after opened kept the label off (issue #2, run).
  • Reopening after that removal added the label, confirming the earlier removal did not suppress it (run).

All three workflow runs completed successfully: run 1, run 2, and run 3.

Related issues and pull requests

@caugner
caugner force-pushed the needs-triage-event-history branch from 6f814f1 to 222dc37 Compare October 12, 2026 17:30
@caugner
caugner marked this pull request as ready for review October 12, 2026 19:12
@caugner
caugner requested a review from a team as a code owner October 12, 2026 19:12
@caugner
caugner requested a review from LeoMcA October 12, 2026 19:12
Comment thread .github/workflows/needs-triage.yml Outdated
run: gh issue edit "$ISSUE_URL" --add-label "$LABEL"
ACTION: ${{ github.event.action }}
TRIGGERED_AT: ${{ github.event.action == 'transferred' && github.event.changes.new_issue.updated_at || github.event.action == 'opened' && github.event.changes.old_issue == null && github.event.issue.created_at || github.event.issue.updated_at }}
run: |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we've entered bash hell 🔥

What would this look like using github actions javascript?

Comment thread .github/workflows/needs-triage.yml Outdated
add
| any(.[];
.event == "unlabeled"
and .label.name == $label

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the labels are case insensitive in the api, but are case sensitive here, so this risks a label being readded if the cases don't match.

@caugner
caugner marked this pull request as draft October 15, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants