Skip to content

Commit

Permalink
Initial commit for v6
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertk committed Apr 29, 2022
1 parent 770989b commit 1e9625a
Show file tree
Hide file tree
Showing 23 changed files with 10,018 additions and 5,701 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.py]
indent_size = 4
67 changes: 52 additions & 15 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,54 @@
env:
node: true
es6: false
jest: true
commonjs: true
---
extends:
- google
- 'plugin:prettier/recommended'
globals:
Atomics: readonly
SharedArrayBuffer: readonly
parserOptions:
ecmaVersion: 2019
sourceType: script
- eslint:recommended
- plugin:node/recommended
- prettier
plugins:
- prettier
rules: {}
- node
- prettier
rules:
prettier/prettier: error
block-scoped-var: error
eqeqeq: error
no-var: error
prefer-const: error
eol-last: error
prefer-arrow-callback: error
no-trailing-spaces: error
quotes:
- warn
- single
- avoidEscape: true
no-restricted-properties:
- error
- object: describe
property: only
- object: it
property: only
overrides:
- files:
- "**/*.ts"
- "**/*.tsx"
parser: "@typescript-eslint/parser"
extends:
- plugin:@typescript-eslint/recommended
rules:
"@typescript-eslint/no-non-null-assertion": 'off'
"@typescript-eslint/no-use-before-define": 'off'
"@typescript-eslint/no-warning-comments": 'off'
"@typescript-eslint/no-empty-function": 'off'
"@typescript-eslint/no-var-requires": 'off'
"@typescript-eslint/explicit-function-return-type": 'off'
"@typescript-eslint/explicit-module-boundary-types": 'off'
"@typescript-eslint/ban-types": 'off'
"@typescript-eslint/camelcase": 'off'
node/no-missing-import: 'off'
node/no-empty-function: 'off'
node/no-unsupported-features/es-syntax: 'off'
node/no-missing-require: 'off'
node/shebang: 'off'
no-dupe-class-members: 'off'
require-atomic-updates: 'off'
parserOptions:
ecmaVersion: 2018
sourceType: module
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
.env
node_modules/
coverage/
lib/**/*
test/runner/*
32 changes: 0 additions & 32 deletions .mergify.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierrc.json

This file was deleted.

6 changes: 6 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bracketSpacing: true
singleQuote: true
trailingComma: es5
arrowParens: avoid
printWidth: 120
10 changes: 0 additions & 10 deletions Dockerfile

This file was deleted.

93 changes: 1 addition & 92 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,92 +1 @@
# "Stale Issue Cleanup" Action for GitHub Actions

This GitHub action warns and then closes issues and PRs without activity
after a specified amount of time. It improves upon [GitHub's original
stale action](https://github.com/actions/stale) by allowing the action
to run only on issues that contain a specified label, and removing labels
once the issue sees new activity.

## Building and testing

Install dependencies
```bash
$ yarn install
```

Run unit tests
```bash
$ yarn test
```

### Local Integ Testing with Docker

This action is using Docker, so you can test it locally in dry run mode if you
wish.

```bash
$ docker build -t stale-issue-cleanup .
$ docker run --label stale-issue-cleanup --env-file test/local-docker.env stale-issue-cleanup
```

Check out [local-docker.env](./test/local-docker.env) to configure your local
testing options. Once you're satisfied that it's working the way you expect,
you can create a workflow file and implement this as an action on your repo.


## Usage

You need to add a workflow file into your repository under
[.github/workflows](./.github/workflows), just like any other Github Action.
This workflow file [follows the standard workflow syntax for Github Actions.](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions).

A sample workflow file for you to use as a drop-in is in [sample_workflow.yml](./sample_workflow.yml).

For a list of options and their description, see [action.yml](./action.yml).

Here's an abbreviated example with just the step for this action:

```yaml
steps:
- uses: aws-actions/stale-issue-cleanup@v3
with:
# Types of issues that will be processed
issue-types: issues,pull_requests

# Messages this action will apply to issues
stale-issue-message: Stale issue message
stale-pr-message: Stale pr message
ancient-issue-message: Ancient issue message
ancient-pr-message: Ancient pr message


# Labels this action will apply to issues
stale-issue-label: closing-soon
exempt-issue-labels: awaiting-approval
stale-pr-label: no-pr-activity
exempt-pr-labels: awaiting-approval
response-requested-label: response-requested
closed-for-staleness-label: closed-for-staleness

# Issue timing and upvote counting
days-before-stale: 4
days-before-close: 7
days-before-ancient: 365
minimum-upvotes-to-exempt: 10

# Testing/debugging options
loglevel: DEBUG
dry-run: true

# Leave this alone, or set to a PAT for the action to use
repo-token: ${{ secrets.GITHUB_TOKEN }}
```

**NOTE:** For stability, you should use the action with either an
explicit tag, or commit SHA:

`uses: aws-actions/stale-issue-cleanup@v3`

## License Summary

This code is made available under the Apache-2.0 license.
See [LICENSE](./LICENSE).
TODO: redo the readme
130 changes: 72 additions & 58 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,86 @@
---
name: "'Stale Issue Cleanup' Action for GitHub Actions"
description: 'Close issues and pull requests with no recent activity'
branding:
icon: 'cloud'
color: 'orange'
inputs:
repo-token:
description: 'Token for the repository. Can be passed in using {{ secrets.GITHUB_TOKEN }}'
required: true
issue-types:
description: 'Issue types to process ("issues", "pull_requests", or "issues,pull_requests")'
default: 'issues,pull_requests'
stale-issue-message:
description: 'The message to post on the issue when tagging it. If none provided, will not mark issues stale.'
stale-pr-message:
description: 'The message to post on the pr when tagging it. If none provided, will not mark pull requests stale.'
days-before-stale:
description: 'The number of days old an issue can be before marking it stale.'
default: 60
days-before-close:
description: 'The number of days to wait to close an issue or pull request after it being marked stale.'
default: 7
stale-issue-label:
description: 'The label to apply when an issue is stale.'
default: 'Stale'
exempt-issue-labels:
description: 'The labels to apply when an issue is exempt from being marked stale. Separate multiple labels with commas (eg. "label1,label2")'
stale-pr-label:
description: 'The label to apply when a pull request is stale.'
default: 'Stale'
exempt-pr-labels:
description: 'The labels to apply when a pull request is exempt from being marked stale. Separate multiple labels with commas (eg. "label1,label2")'
ancient-issue-message:
description: 'The message to post when an issue is very old.'
ancient-pr-message:
description: 'The message to post when a pr is very old.'
days-before-ancient:
description: 'The number of days old an issue can be before marking it ancient.'
default: 360
response-requested-label:
description: 'The label that gets applied when a response is requested.'
closed-for-staleness-label:
description: 'The label that gets applied when an issue is closed for staleness.'
minimum-upvotes-to-exempt:
description: 'The minimum number of "upvotes" that an issue needs to have before not marking as ancient.'
loglevel:
description: 'Set to DEBUG to enable debug logging'
description: 'The minimum number of "upvotes" that an issue needs to have before never closing it.'
default: 0
dry-run:
description: 'Set to true to not perform repository changes'
default: false

#name: "'Stale Issue Cleanup' Action for GitHub Actions"
#description: 'Close issues and pull requests with no recent activity'
#branding:
# icon: 'cloud'
# color: 'orange'
#inputs:
# repo-token:
# description: 'Token for the repository. Can be passed in using {{ secrets.GITHUB_TOKEN }}'
# required: true
# issue-types:
# description: 'Issue types to process ("issues", "pull_requests", or "issues,pull_requests")'
# default: 'issues,pull_requests'
# stale-issue-message:
# description: 'The message to post on the issue when tagging it. If none provided, will not mark issues stale.'
# stale-pr-message:
# description: 'The message to post on the pr when tagging it. If none provided, will not mark pull requests stale.'
# days-before-stale:
# description: 'The number of days old an issue can be before marking it stale.'
# default: 60
# days-before-close:
# description: 'The number of days to wait to close an issue or pull request after it being marked stale.'
# default: 7
# stale-issue-label:
# description: 'The label to apply when an issue is stale.'
# default: 'Stale'
# exempt-issue-labels:
# description: 'The labels to apply when an issue is exempt from being marked stale. Separate multiple labels with commas (eg. "label1,label2")'
# stale-pr-label:
# description: 'The label to apply when a pull request is stale.'
# default: 'Stale'
# exempt-pr-labels:
# description: 'The labels to apply when a pull request is exempt from being marked stale. Separate multiple labels with commas (eg. "label1,label2")'
# ancient-issue-message:
# description: 'The message to post when an issue is very old.'
# ancient-pr-message:
# description: 'The message to post when a pr is very old.'
# days-before-ancient:
# description: 'The number of days old an issue can be before marking it ancient.'
# default: 360
# response-requested-label:
# description: 'The label that gets applied when a response is requested.'
# closed-for-staleness-label:
# description: 'The label that gets applied when an issue is closed for staleness.'
# minimum-upvotes-to-exempt:
# description: 'The minimum number of "upvotes" that an issue needs to have before not marking as ancient.'
# loglevel:
# description: 'Set to DEBUG to enable debug logging'
# dry-run:
# description: 'Set to true to not perform repository changes'

runs:
using: 'docker'
image: 'Dockerfile'
using: 'node16'
main: 'dist/index.js'
env:
REPO_TOKEN: ${{ inputs.repo-token }}
ISSUE_TYPES: ${{ inputs.issue-types }}
ANCIENT_ISSUE_MESSAGE: ${{ inputs.ancient-issue-message }}
ANCIENT_PR_MESSAGE: ${{ inputs.ancient-pr-message }}
STALE_ISSUE_MESSAGE: ${{ inputs.stale-issue-message }}
STALE_PR_MESSAGE: ${{ inputs.stale-pr-message }}
DAYS_BEFORE_STALE: ${{ inputs.days-before-stale }}
DAYS_BEFORE_CLOSE: ${{ inputs.days-before-close }}
DAYS_BEFORE_ANCIENT: ${{ inputs.days-before-ancient }}
STALE_ISSUE_LABEL: ${{ inputs.stale-issue-label }}
EXEMPT_ISSUE_LABELS: ${{ inputs.exempt-issue-labels }}
STALE_PR_LABEL: ${{ inputs.stale-pr-label }}
EXEMPT_PR_LABELS: ${{ inputs.exempt-pr-labels }}
RESPONSE_REQUESTED_LABEL: ${{ inputs.response-requested-label }}
CFS_LABEL: ${{ inputs.closed-for-staleness-label }}
REPO_TOKEN: ${{ github.token }}
# ISSUE_TYPES: ${{ inputs.issue-types }}
# ANCIENT_ISSUE_MESSAGE: ${{ inputs.ancient-issue-message }}
# ANCIENT_PR_MESSAGE: ${{ inputs.ancient-pr-message }}
# STALE_ISSUE_MESSAGE: ${{ inputs.stale-issue-message }}
# STALE_PR_MESSAGE: ${{ inputs.stale-pr-message }}
# DAYS_BEFORE_STALE: ${{ inputs.days-before-stale }}
# DAYS_BEFORE_CLOSE: ${{ inputs.days-before-close }}
# DAYS_BEFORE_ANCIENT: ${{ inputs.days-before-ancient }}
# STALE_ISSUE_LABEL: ${{ inputs.stale-issue-label }}
# EXEMPT_ISSUE_LABELS: ${{ inputs.exempt-issue-labels }}
# STALE_PR_LABEL: ${{ inputs.stale-pr-label }}
# EXEMPT_PR_LABELS: ${{ inputs.exempt-pr-labels }}
# RESPONSE_REQUESTED_LABEL: ${{ inputs.response-requested-label }}
# CFS_LABEL: ${{ inputs.closed-for-staleness-label }}
MINIMUM_UPVOTES_TO_EXEMPT: ${{ inputs.minimum-upvotes-to-exempt }}
LOGLEVEL: ${{ inputs.loglevel }}
# LOGLEVEL: ${{ inputs.loglevel }}
DRYRUN: ${{ inputs.dry-run }}
Loading

0 comments on commit 1e9625a

Please sign in to comment.