From 80eb15304c31af47198eb7c1a78f845195396962 Mon Sep 17 00:00:00 2001 From: Nissim Lebovits <111617674+nlebovits@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:48:12 +0200 Subject: [PATCH] Lebovits/issu791 automate pr mgmt (#795) * add auto labeleing and auto assigning for PRs --- .github/auto_assign.yml | 26 +++++++++++++++++++++++++ .github/labeler.yml | 10 ++++++++++ .github/workflows/flag-stale-prs.yml | 17 ++++++++++++++++ .github/workflows/label-and-assign.yml | 27 ++++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 .github/auto_assign.yml create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/flag-stale-prs.yml create mode 100644 .github/workflows/label-and-assign.yml diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml new file mode 100644 index 00000000..3841c5e2 --- /dev/null +++ b/.github/auto_assign.yml @@ -0,0 +1,26 @@ +# Set to true to add reviewers to pull requests +addReviewers: true + +# Set to true to add assignees to pull requests +addAssignees: false + +# A number of reviewers added to the pull request +# Set 0 to add all the reviewers (default: 0) +numberOfReviewers: 1 + +# Set to true to add reviewers from different groups to pull requests +useReviewGroups: true + +# A list of reviewers, split into different groups, to be added to pull requests (GitHub user name) +reviewGroups: + backend: + - zigouras + frontend: + - CodeWritingCow + +# Set to true to add assignees from different groups to pull requests +useAssigneeGroups: false + +# A list of keywords to be skipped the process that add reviewers if pull requests include it +skipKeywords: + - wip diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..3c6d5afd --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,10 @@ +backend: + - changed-files: + - any-glob-to-any-file: 'data/**' + +frontend: + - changed-files: + - any-glob-to-any-file: + - 'src/**' + - '*' + - '!(data)/**' diff --git a/.github/workflows/flag-stale-prs.yml b/.github/workflows/flag-stale-prs.yml new file mode 100644 index 00000000..68f8badc --- /dev/null +++ b/.github/workflows/flag-stale-prs.yml @@ -0,0 +1,17 @@ +name: Flag Stale PRs + +on: + schedule: + - cron: '0 0 * * *' # Runs every day at midnight + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-stale: 7 + stale-pr-message: 'This PR has been marked as stale because it has been open for 7 days with no activity.' + stale-pr-label: 'stale' + only-labels: 'backend, frontend' diff --git a/.github/workflows/label-and-assign.yml b/.github/workflows/label-and-assign.yml new file mode 100644 index 00000000..9f133b8d --- /dev/null +++ b/.github/workflows/label-and-assign.yml @@ -0,0 +1,27 @@ +name: Label and Assign Reviewers + +on: [pull_request] + +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Label PR + uses: actions/labeler@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + assign-reviewers: + runs-on: ubuntu-latest + needs: label + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Assign Reviewers + uses: kentaro-m/auto-assign-action@v2.0.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: '.github/auto_assign.yml'