https://github.com/ory/closed-reference-notifier
A GitHub action to open an issue when GitHub references in your code are closed.
https://github.com/ory/closed-reference-notifier
hacktoberfest
Last synced: 8 months ago
JSON representation
A GitHub action to open an issue when GitHub references in your code are closed.
- Host: GitHub
- URL: https://github.com/ory/closed-reference-notifier
- Owner: ory
- License: apache-2.0
- Created: 2020-04-21T14:04:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-12T16:27:10.000Z (10 months ago)
- Last Synced: 2025-04-19T07:15:03.233Z (8 months ago)
- Topics: hacktoberfest
- Language: TypeScript
- Homepage:
- Size: 1.24 MB
- Stars: 21
- Watchers: 10
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Closed Reference Notifier Action
A GitHub action to open an issue when GitHub references in your code are closed.
These could be references to open pull requests or issues.
Quite often you will have references like this one in your code:
```js
// workaround for https://github.com/ory/kratos/issues/364
dsn = `${dsn}&multiStatements=true`
```
You will then either have to remind yourself to check back or (more likely) you
will stumble across the comment some time later to manually check whether the
issue got fixed. This simple GitHub actions searches your whole repository for
references to GitHub pulls and issues. When it finds a closed reference it will
open an issue in your repository. That way you will automatically be reminded to
check back on the reference.
## Configuration
Please note that this action has to run on node.js 14, which is currently only
possible using a workaround. Therefore, you have to make sure this action runs
on a sufficient node version, e.g. by using this minimal job config:
```yaml
jobs:
find_closed_references:
runs-on: ubuntu-latest
name: Find closed references
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: "14"
- uses: ory/closed-reference-notifier@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
```
We recommend having this action run regularly e.g. daily. To enable access to
the GitHub API you have to set the token input (see below).
All other inputs are optional.
| Key | Description | Default value |
| ----------- | -------------------------------------------------------------- | ---------------- |
| ignore | ignore paths, comma seperated list of .gitignore style entries | .git |
| issueLabels | the labels to create issues with, comma seperated list | closed reference |
| issueLimit | the maximum number of issues to create, supposed to catch bugs | 5 |
Additionally to setting `ignore` as an input, you can also place a
`.reference-ignore` file in the root of your repo (entries should be `\n`
separated). Both, the input and the file will be concatenated.
Individual references can be marked as intentional by placing two exclamation
marks immediately behind the reference:
```js
// This prevents regression of github.com/testUser/testRepo/pull/420!!
t.Skip()
```
Note that the action fails when there are more issues to be created than the
limit allows. This is because GitHub Actions do not have manual approval.
Verbose example with all inputs:
```yaml
on:
schedule:
- cron: "0 7 * * *"
jobs:
find_closed_references:
runs-on: ubuntu-latest
name: Find closed references
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: "14"
- uses: ory/closed-reference-notifier@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ignore: .git
issueLabels: closed reference
issueLimit: 5
```
## Testing manually before automating
To manually test what references this action finds you can run
```
$ npx https://github.com/ory/closed-reference-notifier.git local/path/to/repo ignore,list
```
## Manual workflow trigger
To allow for easy temporary issue limit raising, we recommend you add the
following manual trigger:
```yaml
on:
workflow_dispatch:
inputs:
issueLimit:
description: maximum number of issues to create
required: true
default: "5"
jobs:
find_closed_references:
runs-on: ubuntu-latest
name: Find closed references
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: "14"
- uses: ory/closed-reference-notifier@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# fall back to 5 when the issueLimit is not available (e.g. with a scheduled event)
issueLimit: ${{ github.event.inputs.issueLimit || '5' }}
```