roots / issue-closer-action

GitHub action to automatically close issues/PRs that don't match a regexp
MIT License
34 stars 5 forks source link

Add a label when closing an issue. #2

Open hjdhjd opened 4 years ago

hjdhjd commented 4 years ago

Summary

Once issue-closer-action has determined that an issue should be closed, it would be helpful if it also had an option to also add a label to the issue.

Motivation

It would improve sorting through closed issues at a glance, particularly in higher-trafficked repos.

Additional context

None needed.

swalkinshaw commented 3 years ago

Good idea 👍 do you want to try contributing this?

joey-ma commented 1 year ago

2 years have passed, and here I am thinking the same thing!

I'd be happy to take a look, except I am pretty new to this and am just exploring GitHub Actions. I'm not familiar with how I can test it on my own, so feedback is greatly appreciated! @swalkinshaw @hjdhjd

So far, combining my intuition and findings from resources below:

  1. workflow Annotations (logs) Unexpected input(s) 'close-issue-reason', 'close-issue-label', valid inputs are ['issue-close-message', 'issue-pattern', 'pr-close-message', 'pr-pattern', 'repo-token']
  2. close-issue-label from List of input options of GitHub Action's Close Stale Issues workflow actions/stale@v7.0.0
  3. Template starter-workflow from Github Actions manual.yml

I'm guessing I'd go to action.yml, under inputs, add another optional input close-issue-label with properties description and required, like so:

  close-issue-label:
    description: Label to apply on closed issues
    required: false

Inside YOUR_WORKFLOW.yml, add permissions to follow runs-on:

    runs-on: ubuntu-latest # existing line
    permissions:
      issues: write
    steps: # existing line

Thanks 🙏🏻