Skip to content

Commit

Permalink
Merge pull request internetarchive#8744 from jimchamp/auto-unassigner
Browse files Browse the repository at this point in the history
Auto unassigner
  • Loading branch information
mekarpeles authored Jan 24, 2024
2 parents 5ac6ded + 43ba6bf commit 6617494
Show file tree
Hide file tree
Showing 4 changed files with 505 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/auto_unassigner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: auto_unassigner
on:
schedule: # Run at 0800 AM, daily (runs before new_comment_digest workflow).
- cron: '0 8 * * *'
workflow_dispatch: # This can be run on-demand (do we want this?)
permissions:
contents: read
issues: write

jobs:
auto_unassigner:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '20'
- run: npm install @octokit/action
- run: node scripts/gh_scripts/auto_unassigner.mjs --repoOwner $GITHUB_REPOSITORY_OWNER
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ repos:
- id: codespell # See pyproject.toml for args
additional_dependencies:
- tomli
args: ["--skip", "*.mjs"]

- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.16.0
Expand Down
23 changes: 23 additions & 0 deletions scripts/gh_scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

This directory contains scripts that the Open Library team uses to interact with this GitHub repository.

## `auto_unassigner.mjs`

This script fetches all open issues that have assignees and automatically removes assignees that meet the following criteria:
- Assignee has been assigned for more than 14 days and has not created and linked a pull request to the issue.
- Assignee's GitHub username does not appear on the exclude list.

This script skips over issues that have the `no-automation` label.

This script takes two options:
- `--daysSince` Integer that defines the number of days until an assignee is stale. Defaults to `14`.
- `--repoOwner` String that defines the specific `openlibrary` repository. Defaults to `internetarchive`.

> [!IMPORTANT]
> Include a space between an option and its value when calling this script.
__Correct:__
`node auto_unassigner.mjs --daysSince 21`

__Incorrect:__
`node auto_unassigner.mjs --daysSince=21`

The GitHub action that runs this script automatically sets `--repoOwner` to the owner of the repository that triggered the action.

To quickly see a script's purpose and arguments, run the script with the `-h` or `--help` flag.

## `issue_comment_bot.py`
Expand Down
Loading

0 comments on commit 6617494

Please sign in to comment.