Skip to content

Commit

Permalink
add workflows to triage open-source issues and pulls (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachmari authored Oct 1, 2020
1 parent 7271fb2 commit f9c2a6e
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/triage-issue-comments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Triage new issue comments
on:
issue_comment:
types: [created]

jobs:
triage-issue-comments:
if: github.repository == 'github/docs'
runs-on: ubuntu-latest

steps:
- name: Check if the event originated from a team member
uses: actions/[email protected]
id: is-internal-contributor
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
const repo = context.payload.repository.name
const org = context.payload.repository.owner.login
const actor = context.actor
let collaboratorStatus = ''
try {
collaboratorStatus = await github.request('GET /repos/{owner}/{repo}/collaborators/{username}', {
owner: org,
repo: repo,
username: actor
})
console.log(`This issue was commented on by a Hubber.`)
return 'true'
} catch (error) {
console.log(`This issue was commented on by an external contributor.`)
return 'false'
}
- name: Label issues with new comments with 'triage'
uses: andymckay/[email protected]
if: (steps.is-internal-contributor.outputs.result == 'false')
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
add-labels: "triage"
- name: Triage to project board
uses: konradpabjan/[email protected]
with:
action-token: ${{ secrets.GITHUB_TOKEN }}
project-url: "https://github.com/github/docs/projects/1"
column-name: "Triage"
22 changes: 22 additions & 0 deletions .github/workflows/triage-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Triage new issues
on:
issues:
types: [reopened, opened]

jobs:
triage_issues:
if: github.repository == 'github/docs'
runs-on: ubuntu-latest

steps:
- name: Label new issues with 'triage'
uses: andymckay/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
add-labels: "triage"
- name: Triage to project board
uses: konradpabjan/[email protected]
with:
action-token: ${{ secrets.GITHUB_TOKEN }}
project-url: "https://github.com/github/docs/projects/1"
column-name: "Triage"
22 changes: 22 additions & 0 deletions .github/workflows/triage-pull-requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Triage new pull requests
on:
pull_request:
types: [reopened, opened]

jobs:
triage_issues:
if: github.repository == 'github/docs'
runs-on: ubuntu-latest

steps:
- name: Label new pull requests with 'triage'
uses: andymckay/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
add-labels: "triage"
- name: Triage to project board
uses: konradpabjan/[email protected]
with:
action-token: ${{ secrets.GITHUB_TOKEN }}
project-url: "https://github.com/github/docs/projects/1"
column-name: "Triage"
18 changes: 18 additions & 0 deletions .github/workflows/triage-stale-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Public Repo Stale Check
on:
schedule:
- cron: "45 16 * * *" # Run each day at 16:45 UTC / 8:45 PST

jobs:
stale:
if: github.repository == 'github/docs'
runs-on: ubuntu-latest

steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-pr-message: 'This PR is stale because it has been open 7 days with no activity and will be automatically closed in 3 days. To keep this PR open, update the PR by adding a comment or pushing a commit.'
days-before-stale: 7
days-before-close: 10
stale-pr-label: 'stale'

0 comments on commit f9c2a6e

Please sign in to comment.