From f9c2a6ee4ca0f94e366bf04a6f2b6dcf8e66ee3b Mon Sep 17 00:00:00 2001 From: Rachael Sewell Date: Thu, 1 Oct 2020 14:04:08 -0700 Subject: [PATCH] add workflows to triage open-source issues and pulls (#67) --- .github/workflows/triage-issue-comments.yml | 46 +++++++++++++++++++++ .github/workflows/triage-issues.yml | 22 ++++++++++ .github/workflows/triage-pull-requests.yml | 22 ++++++++++ .github/workflows/triage-stale-check.yml | 18 ++++++++ 4 files changed, 108 insertions(+) create mode 100644 .github/workflows/triage-issue-comments.yml create mode 100644 .github/workflows/triage-issues.yml create mode 100644 .github/workflows/triage-pull-requests.yml create mode 100644 .github/workflows/triage-stale-check.yml diff --git a/.github/workflows/triage-issue-comments.yml b/.github/workflows/triage-issue-comments.yml new file mode 100644 index 000000000000..77a7e851342c --- /dev/null +++ b/.github/workflows/triage-issue-comments.yml @@ -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/github-script@v2.0.0 + 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/labeler@v1.0.2 + if: (steps.is-internal-contributor.outputs.result == 'false') + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + add-labels: "triage" + - name: Triage to project board + uses: konradpabjan/actions-add-new-issue-to-column@v1.1 + with: + action-token: ${{ secrets.GITHUB_TOKEN }} + project-url: "https://github.com/github/docs/projects/1" + column-name: "Triage" diff --git a/.github/workflows/triage-issues.yml b/.github/workflows/triage-issues.yml new file mode 100644 index 000000000000..301592da99c7 --- /dev/null +++ b/.github/workflows/triage-issues.yml @@ -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/labeler@v1.0.2 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + add-labels: "triage" + - name: Triage to project board + uses: konradpabjan/actions-add-new-issue-to-column@v1.1 + with: + action-token: ${{ secrets.GITHUB_TOKEN }} + project-url: "https://github.com/github/docs/projects/1" + column-name: "Triage" diff --git a/.github/workflows/triage-pull-requests.yml b/.github/workflows/triage-pull-requests.yml new file mode 100644 index 000000000000..07ebe4ba0a34 --- /dev/null +++ b/.github/workflows/triage-pull-requests.yml @@ -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/labeler@v1.0.2 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + add-labels: "triage" + - name: Triage to project board + uses: konradpabjan/actions-add-new-issue-to-column@v1.1 + with: + action-token: ${{ secrets.GITHUB_TOKEN }} + project-url: "https://github.com/github/docs/projects/1" + column-name: "Triage" diff --git a/.github/workflows/triage-stale-check.yml b/.github/workflows/triage-stale-check.yml new file mode 100644 index 000000000000..0b329c4ae923 --- /dev/null +++ b/.github/workflows/triage-stale-check.yml @@ -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'