From ee5582f7318b5de17a247bf2a2bae3a23f04a690 Mon Sep 17 00:00:00 2001 From: Samuel Enderwitz <18609909+smuu@users.noreply.github.com> Date: Wed, 3 May 2023 11:23:37 +0200 Subject: [PATCH] feat: housekeeping (#905) Part of EPIC https://github.com/celestiaorg/devops/issues/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.
Reviwer rules - `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`).
Closes https://github.com/celestiaorg/devops/issues/260 --------- Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com> --- .github/auto_request_review.yml | 32 ++++++++++++++ .github/dependabot.yml | 4 ++ .github/workflows/housekeeping.yml | 71 ++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 .github/auto_request_review.yml create mode 100644 .github/workflows/housekeeping.yml diff --git a/.github/auto_request_review.yml b/.github/auto_request_review.yml new file mode 100644 index 00000000000..a31206df495 --- /dev/null +++ b/.github/auto_request_review.yml @@ -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 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 85f220ebf5c..14c2668b52d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,6 +5,8 @@ updates: schedule: interval: daily open-pull-requests-limit: 10 + labels: + - T:dependencies - package-ecosystem: gomod directory: "/" schedule: @@ -17,3 +19,5 @@ updates: schedule: interval: weekly open-pull-requests-limit: 10 + labels: + - T:dependencies diff --git a/.github/workflows/housekeeping.yml b/.github/workflows/housekeeping.yml new file mode 100644 index 00000000000..d0c589ea7a0 --- /dev/null +++ b/.github/workflows/housekeeping.yml @@ -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