Skip to content

Filter based on issue type #1187

Open
@Bibo-Joshi

Description

@Bibo-Joshi

Description:
Introduce a parameter only-issue-types that ensures that only issues of a specific type are set to stale and closed.

Justification:
With the introduction of types, GitHub as given organizations a new issue attribute that can be used for categorization/classification of issues. For different issue types it would be desirable to have different stale settings just like we currently can have for labels. E.g. in my organization, we'll be using the new issue type for separating questions from feature requests. Questions should go stale faster.

Are you willing to submit a PR?
I'm open to try so, but will need some pointers, especially on testing. I'm not familia with TypeScript (or very familiar with JS at all …)

Activity

mahabaleshwars

mahabaleshwars commented on Nov 4, 2024

@mahabaleshwars

Hello @Bibo-Joshi,
Thank you for creating this issue. We will investigate it and provide feedback as soon as we have some updates.

JosephTLyons

JosephTLyons commented on Jan 28, 2025

@JosephTLyons

We are switching over to issue types as well over in zed.dev's issue tracker - would love to have this configuration option.

maxwxyz

maxwxyz commented on Feb 22, 2025

@maxwxyz

This is very much needed, otherwise we have duplicates for labels and types now.

JosephTLyons

JosephTLyons commented on Feb 27, 2025

@JosephTLyons

One thing to note is that GitHub's REST API doesn't even support filtering by type, as far as I can tell. So until that lands, getting that feature in the stale action is totally blocked.

https://github.com/orgs/community/discussions/140874#discussioncomment-11582660

added a commit that references this issue on Mar 25, 2025
JasonStoltz

JasonStoltz commented on Mar 28, 2025

@JasonStoltz

Looks like they've added Issue Type to the Reset API.

Mister-Hope

Mister-Hope commented on Apr 9, 2025

@Mister-Hope

Any progress with this one? I think there are no blocking things with it.

andig

andig commented on Apr 29, 2025

@andig

Stale bot is currently unusable without support for issue types...

Bibo-Joshi

Bibo-Joshi commented on Apr 30, 2025

@Bibo-Joshi
Author

@mahabaleshwars I'd still be open to giving this a shot if you could provide me with a few pointers on how to get started :)

Tobi-mmt

Tobi-mmt commented on May 13, 2025

@Tobi-mmt

@Bibo-Joshi Since it is pretty much the same as the exempt-issue-labels option right now, I guess its something like:

  1. check out the repo and read the https://github.com/actions/stale/blob/main/CONTRIBUTING.md
  2. extend the options enum like here
    ExemptIssueLabels = 'exempt-issue-labels',
  3. do something similar to the exeption logik here:
    const exemptLabels: string[] = wordsToList(
    issue.isPullRequest
    ? this.options.exemptPrLabels
    : this.options.exemptIssueLabels
    );
    const hasExemptLabel = exemptLabels.some((exemptLabel: Readonly<string>) =>
    isLabeled(issue, exemptLabel)
    );
    if (hasExemptLabel) {
    issueLogger.info(
    `Skipping this $$type because it contains an exempt label, see ${issueLogger.createOptionLink(
    issue.isPullRequest ? Option.ExemptPrLabels : Option.ExemptIssueLabels
    )} for more details`
    );
    IssuesProcessor._endIssueProcessing(issue);
    return; // Don't process exempt issues
    }
  4. extend the docs like here
    exempt-issue-labels:
  5. search the whole repo for exempt-issue-labels and ExemptIssueLabels to find all occurence where you have to
  6. add a test like here

    stale/__tests__/main.spec.ts

    Lines 1021 to 1051 in f78de97

    test('exempt issue labels will not be marked stale', async () => {
    expect.assertions(3);
    const opts = {...DefaultProcessorOptions};
    opts.exemptIssueLabels = 'Exempt';
    const TestIssueList: Issue[] = [
    generateIssue(
    opts,
    1,
    'My first issue',
    '2020-01-01T17:00:00Z',
    '2020-01-01T17:00:00Z',
    false,
    false,
    ['Exempt']
    )
    ];
    const processor = new IssuesProcessorMock(
    opts,
    alwaysFalseStateMock,
    async p => (p === 1 ? TestIssueList : []),
    async () => [],
    async () => new Date().toDateString()
    );
    // process our fake issue list
    await processor.processIssues(1);
    expect(processor.staleIssues.length).toStrictEqual(0);
    expect(processor.closedIssues.length).toStrictEqual(0);
    expect(processor.removedLabelIssues.length).toStrictEqual(0);
    });

4 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or request to improve the current logic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @andig@JasonStoltz@maxwxyz@Tobi-mmt@JosephTLyons

      Issue actions

        Filter based on issue type · Issue #1187 · actions/stale