Skip to content

Commit

Permalink
Initial codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuart Izon committed Jan 4, 2024
0 parents commit cf0fd34
Show file tree
Hide file tree
Showing 10 changed files with 41,781 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Check dist

on:
push:
branches:
- main
paths-ignore:
- '**.md'

jobs:
check-dist:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 20.x
- name: Install dependencies
run: npm ci
- name: Rebuild the index.js file
run: npm run build
- name: Compare the expected and actual dist/ directories
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
- name: Upload diff artifact
uses: actions/upload-artifact@v2
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
15 changes: 15 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Test

on:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: RelationalAI/abandoned
with:
days: 7
token: ${{ github.token }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Contributing

Before pushing a change, update `dist/index.js` using `npm run build`. This creates a single javascript file that is used as an entrypoint for the action.
Failure to do so will generate a build failure.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Abandoned
This action finds old, abandoned PRs for a given repository.

# Usage
```
- uses: RelationalAI/abandoned
with:
# Number of days before PR should be considered abandoned
days: 7
# Personal access token (PAT) with access to the repository.
# Default: ${{ github.token }}
token: ''
```

# Output
A single output `pulls` contains the list of abandoned PRs. It is structured as an array, where each entry has the following fields:
- `title` - the title of the GitHub PR
- `ref` - the ref for the HEAD of the PR branch
- `sha` - the SHA for the HEAD of the PR branch
- `url` - the HTML url page for the PR

This array can be fed into [matrix jobs](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs) to run a given task for each PR.
19 changes: 19 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Abandoned'
description: 'Finds old, abandoned PRs in a given repository'

inputs:
days:
description: 'Number of days before PR should be considered abandoned'
required: false
default: '7'
token:
required: true
description: 'GitHub token'

outputs:
pulls:
description: 'Array of PR objects (title, ref, sha and url)'

runs:
using: "node20"
main: 'dist/index.js'
Loading

0 comments on commit cf0fd34

Please sign in to comment.