Skip to content

Commit

Permalink
chore(infra): cleanup triage workflows (#2222)
Browse files Browse the repository at this point in the history
* chore(ci): improve triage workflow

- Prevent funning the triage PR workflow for dependabot submitted PRs.
  This is failing because the required credential is not available for
  that workflow on dependabot submitted PRs.

- Add names to jobs.

* Comment only on PRs submitted from other repos

* split triage into separate workflows for issues and PRs

* remove redundant condition check

* add default scoped permissions for the workflow

* fix names in Triage PR workflow

* fix names in triage issues workflow
  • Loading branch information
julio-lopez committed Sep 19, 2023
1 parent 6d0264e commit bf03057
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 54 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/triage-issues.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Triage Issues

on:
issues:
types:
- opened
- reopened

jobs:
triage:
if: github.repository == 'kanisterio/kanister'
name: Triage
permissions:
issues: write
runs-on: ubuntu-latest
steps:
-
name: Add label
uses: actions-ecosystem/action-add-labels@v1.1.3
with:
labels: "triage"
github_token: ${{ secrets.GITHUB_TOKEN }}
-
name: Add comment
uses: actions-ecosystem/action-create-comment@v1.0.2
if: github.event.action == 'opened'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
body: |
Thanks for opening this issue :+1:. The team will review it shortly.
If this is a bug report, make sure to include clear instructions how on to reproduce the problem with [minimal reproducible examples](https://stackoverflow.com/help/minimal-reproducible-example), where possible. If this is a security report, please review our security policy as outlined in [SECURITY.md](https://github.com/kanisterio/kanister/blob/master/SECURITY.md).
If you haven't already, please take a moment to review our project's [Code of Conduct](https://github.com/kanisterio/kanister/blob/master/CODE_OF_CONDUCT.md) document.
-
name: Update project
uses: alex-page/github-project-automation-plus@v0.8.3
with:
repo-token: ${{ secrets.GH_TOKEN }} # must use a PAT here
project: Kanister
column: To Be Triaged
40 changes: 40 additions & 0 deletions .github/workflows/triage-prs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Triage

on:
pull_request:
types:
- opened
- reopened

permissions:
contents: read

jobs:
pull-requests-comment:
name: Comment and Triage
if: github.repository == 'kanisterio/kanister' && github.actor != 'dependabot'
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
-
name: Comment
uses: actions-ecosystem/action-create-comment@v1.0.2
# Avoid adding a comment when the PR is on the same repo.
if: github.event.action == 'opened' && github.event.pull_request.head.repo.fork
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
body: |
Thanks for submitting this pull request :tada:. The team will review it soon and get back to you.
If you haven't already, please take a moment to review our project [contributing guideline](https://github.com/kanisterio/kanister/blob/master/CONTRIBUTING.md) and [Code of Conduct](https://github.com/kanisterio/kanister/blob/master/CODE_OF_CONDUCT.md) document.
-
name: Update status in project
uses: alex-page/github-project-automation-plus@v0.8.3
# This only works for PRs opened in the same repo and not by dependabot.
# Other PRs don't get the necessary credentials.
if: github.repository == 'kanisterio/kanister' && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot'
with:
repo-token: ${{ secrets.GH_TOKEN }}
project: Kanister
column: In Progress
54 changes: 0 additions & 54 deletions .github/workflows/triage.yaml

This file was deleted.

0 comments on commit bf03057

Please sign in to comment.