From f238c09ff9a6f659ed696b35173ecbfc3b5176a9 Mon Sep 17 00:00:00 2001 From: Roniece Ricardo <33437850+RonRicardo@users.noreply.github.com> Date: Mon, 2 Dec 2024 19:06:16 -0500 Subject: [PATCH] Add action for requesting dependabot-updates-reviewers (#53319) Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com> --- .github/workflows/reviewers-dependabot.yml | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/reviewers-dependabot.yml diff --git a/.github/workflows/reviewers-dependabot.yml b/.github/workflows/reviewers-dependabot.yml new file mode 100644 index 000000000000..ce1d69a7b3bd --- /dev/null +++ b/.github/workflows/reviewers-dependabot.yml @@ -0,0 +1,34 @@ +name: Add Dependabot Core Maintainers as Reviewers + +# **What it does**: Automatically add reviewers based on paths, for docs-internal and docs repos. +# **Why we have it**: So dependabot maintainers can be notified about relevant pull requests. +# **Who does it impact**: dependabot-updates-reviewers. + +on: + pull_request: + paths: + - 'data/reusable/dependabot/**' + - 'content/code-security/dependabot/**' + - 'content/rest/dependabot/**' + +jobs: + add-reviewer: + if: github.repository == 'github/docs-internal' || github.repository == 'github/docs' + runs-on: ubuntu-latest + steps: + - name: Check out repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Add Dependabot Core Maintainers as reviewers + env: + GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }} + PR: ${{ github.event.pull_request.html_url }} + run: | + has_reviewer=$( + gh pr view $PR --json reviews | + jq 'any(.reviews[]; select(length > 0))' + ) + if ! $has_reviewer + then + gh pr edit $PR --add-reviewer github/dependabot-updates-reviewers + fi