I have created Workflow for GitHub Actions as described here: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/automating-dependabot-with-github-actions
name: Dependabot auto-approve
on: pull_request_target
permissions:
contents: write
pull-requests: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
# The documentation incorrectly forgets `GITHUB_TOKEN` here.
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Above automation works, but I have a Branch protection rule that requires review from the Code Owners.
Is there a way to include github-actions
to the CODEOWNERS file in order to make its approval counted?
PAT
from a codeowner account instead of theGITHUB_TOKEN
? – Inch