Coder Social home page Coder Social logo

gatsbyjs / stale Goto Github PK

View Code? Open in Web Editor NEW

This project forked from actions/stale

2.0 2.0 0.0 921 KB

Marks issues and pull requests that have not had recent interaction

License: MIT License

TypeScript 95.97% JavaScript 0.86% Dockerfile 3.17%

stale's Introduction

Close Stale Issues and PRs

Warns and then closes issues and PRs that have had no activity for a specified amount of time.

Based on actions/stale.

Additional features:

  • Multiple exempt labels
  • Removes the stale label after activity in the marked issue
  • Add a message when closing an issue
  • DRY run (only logging, no actions)
  • Two outputs (blocks and queue) which can be used for a Slack action or passed to your own action. These outputs list the closed issues after each run

Usage

Arguments

Argument Example Required Description
GITHUB_TOKEN - Required Available via environment variables
DRY_RUN true Optional Default: false. Execute the commands only to the console. No GitHub actions or Slack messages will be run
STALE_ISSUE_MESSAGE 'Marking this issue as stale' Optional If left empty, no issues will be marked as stale
CLOSE_MESSSAGE 'Closing as stale' Optional
STALE_PR_MESSAGE 'Marking this PR as stale' Optional If left empty, no PRs will be marked as stale
DAYS_BEFORE_STALE 20 Required Days before an issue is marked as stale (e.g. 20 days after inactivity)
DAYS_BEFORE_CLOSE 10 Required Days before an issue is closed (e.g. 30 days after inactivity, so 10 days after DAYS_BEFORE_STALE)
STALE_ISSUE_LABEL 'stale?' Required Name of the stale label. Must exist already.
EXEMPT_ISSUE_LABELS see "Workflow Examples" Optional Issues with these labels will stay untouched. Write in YAML syntax to get new line breaks.
STALE_PR_LABEL 'stale?' Required Name of the stale label. Must exist already.
EXEMPT_PR_LABELS see "Workflow Examples" Required PRs with these labels will stay untouched. Write in YAML syntax to get new line breaks.
OPERATIONS_PER_RUN 30 Required The maximum number of operations per run, used to control rate limiting

Workflow Examples

The secret GITHUB_TOKEN is automatically available, however other secrets need to be set in your "Secrets" tab under "Settings".

Basic

on:
  schedule:
    - cron: "0 12 * * *"
name: Run Stale Bot on Issue Comments
jobs:
  build:
    name: stale
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: stale
        uses: gatsbyjs/stale@master
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          DAYS_BEFORE_STALE: 20
          DAYS_BEFORE_CLOSE: 10
          STALE_ISSUE_LABEL: 'stale?'
          STALE_PR_LABEL: 'stale?'
          OPERATIONS_PER_RUN: 30
          STALE_ISSUE_MESSAGE: 'marking this as stale message'
          CLOSE_MESSAGE: 'closing message'
          EXEMPT_ISSUE_LABELS: |
            not stale
            important

Slack

In addition to running the stale bot you can also send a list of closed issues via a bot to a Slack channel. For that the stale action exposes a blocks output which has the correct format of Slack's block kit.

We'd recommend the action Post Slack messages as it uses a Slack bot token (and not e.g. a webhook).

on:
  schedule:
    - cron: "0 12 * * *"
name: Run Stale Bot on Issue Comments
jobs:
  build:
    name: stale
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: stale
        id: stale
        uses: gatsbyjs/stale@master
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          DAYS_BEFORE_STALE: 20
          DAYS_BEFORE_CLOSE: 10
          STALE_ISSUE_MESSAGE: 'marking this as stale'
          CLOSE_MESSAGE: 'closing this issue'
          EXEMPT_ISSUE_LABELS: |
            not stale
            important
      - name: Post slack report
        uses: pullreminders/[email protected]
        env:
          SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }}
        with:
          args: '{\"channel\": \"${{ secrets.SLACK_STALE_CHANNEL_ID }}\", \"text\": \"\", \"blocks\": ${{ steps.stale.outputs.blocks }} }'

It's important that you give the stale action an id so that you can reference its output via steps.<your-id>.outputs.blocks.

Notes

In order to be able to see the results during DRY_RUN you need to set the secret ACTIONS_STEP_DEBUG to true. You can read more on actions/toolkit documention.

Example of Slack bot output

The bot will post a similar message to your channel (the titles are links to the respective issue):

Hi, this is your friendly Stale Action BOT with the latest closed issues

[3] Issues were closed

1. test 08
2. Test 07
3. test 03

stale's People

Contributors

chrispat avatar jeremyepling avatar jrbriggs avatar kaylangan avatar lekoarts avatar ryanwilsonperkin avatar shawnnapora avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.