Skip to content

Commit

Permalink
feat: housekeeping (cosmos#905)
Browse files Browse the repository at this point in the history
Part of EPIC celestiaorg/devops#112

> Note: Before merging this the secrets `ADD_TO_PROJECT_PAT` and
`PAT_FOR_AUTO_REQUEST_REVIEW` are needed to set. See the usage and
explanation
[here](https://github.com/celestiaorg/.github/blob/v0.1.1/.github/workflows/reusable_housekeeping.yml).

Changes in the PR:

- The `.github/dependabot.yml` file is updated to add `T:dependencies`
label for dependency updates in both package ecosystems.
- A new `.github/workflows/housekeeping.yml` file is created to automate
issue and PR housekeeping tasks, such as adding issues and PRs to a
project, adding grooming labels, automatically assigning reviewers,
assigning issues and PRs to their creators, and requiring specific
labels.
- A new `.github/auto_request_review.yml` file is created to configure
the automatic assignment of reviewers based on file changes and reviewer
groups.
<details>
<summary>Reviwer rules</summary>

- `code-owners` group includes:
  - Nashqueue
  - tzdybal
  - gupadhyaya

- `rollkit` group includes:
  - Manav-Aggarwal
  - S1nus
  - tuxcanfly

- `devops` group includes:
  - smuu
  - sysrex
  - jrmanes
  - Bidon15

- `celestia` group includes the `team:celestia` team.

The file patterns and the associated reviewer groups are:

- For any file (`**`), the `code-owners` and `rollkit` groups will be
requested for review.
- For any Dockerfile (`**/*Dockerfile`), the `devops` group will be
requested for review.
- For any file within the `.github` directory and its subdirectories
(`.github/**`), the `devops` group will be requested for review.

The options section specifies that draft PRs will be ignored
(`ignore_draft: true`), PRs with "WIP" in the title will be ignored
(`ignored_keywords: - WIP`), and the number of reviewers to request is 3
(`number_of_reviewers: 3`).
</details>

Closes celestiaorg/devops#260

---------

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>
  • Loading branch information
smuu authored May 3, 2023
1 parent 931c35c commit ee5582f
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/auto_request_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
reviewers:
defaults:
- code-owners
groups:
code-owners:
- Nashqueue
- tzdybal
- gupadhyaya
rollkit:
- Manav-Aggarwal
- S1nus
- tuxcanfly
devops:
- smuu
- sysrex
- jrmanes
- Bidon15
celestia:
- team:celestia
files:
'**':
- code-owners
- rollkit
'**/*Dockerfile':
- devops
'.github/**':
- devops
options:
ignore_draft: true
ignored_keywords:
- WIP
number_of_reviewers: 3
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ updates:
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- T:dependencies
- package-ecosystem: gomod
directory: "/"
schedule:
Expand All @@ -17,3 +19,5 @@ updates:
schedule:
interval: weekly
open-pull-requests-limit: 10
labels:
- T:dependencies
71 changes: 71 additions & 0 deletions .github/workflows/housekeeping.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Housekeeping

on:
issues:
types: [opened]
pull_request_target:
types: [opened]

jobs:
project:
name: Add issues and PRs to project and add grooming label
uses: celestiaorg/.github/.github/workflows/reusable_housekeeping.yml@v0.1.1
secrets: inherit
permissions:
issues: write
pull-requests: write
with:
run-labels: true
labels-to-add: 'needs-grooming'
run-projects: true
project-url: https://github.com/orgs/rollkit/projects/7

auto-add-reviewer:
name: Auto add reviewer to PR
if: github.event.pull_request
uses: celestiaorg/.github/.github/workflows/reusable_housekeeping.yml@v0.1.1
secrets: inherit
permissions:
issues: write
pull-requests: write
with:
run-auto-request-review: true

auto-add-assignee:
name: Assign issue and PR to creator
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Set issue url and creator login
if: ${{ github.event.issue }}
run: |
echo "ISSUE=${{ github.event.issue.html_url }}" >> $GITHUB_ENV
echo "CREATOR=${{ github.event.issue.user.login }}" >> $GITHUB_ENV
- name: Set pull_request url and creator login
if: ${{ github.event.pull_request }}
# yamllint disable rule:line-length
run: |
echo "PR=${{ github.event.pull_request.html_url }}" >> $GITHUB_ENV
echo "CREATOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV
# yamllint enable rule:line-length
- name: Assign issue to creator (issue)
if: ${{ github.event.issue }}
run: gh issue edit ${{ env.ISSUE }} --add-assignee ${{ env.CREATOR }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Assign issue to creator (PR)
if: ${{ github.event.pull_request }}
run: gh pr edit ${{ env.PR }} --add-assignee ${{ env.CREATOR }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

required-labels:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v4
with:
mode: minimum
count: 1
labels: "T:enhancement, T:documentation, T:code-hygiene, T:bug, T:adr, T:sdk, T:testing, T:question, T:dependencies, T:spec-and-docs, T:da-integration, T:dev-usability-and-ux" # yamllint disable-line rule:line-length

0 comments on commit ee5582f

Please sign in to comment.