Sample workflows

Auto-merge that trusts github.actor

Merges pull requests when github.actor is dependabot[bot].

github.actor is whoever acted on the pull request last, not who opened it. Researchers have shown how to get Dependabot to make the last change on a branch an attacker controls, so the check passes and the workflow merges the attacker's code with a token that can write.

Check the pull request's author (github.event.pull_request.user.login) instead.

# Approves and merges Dependabot's pull requests. It trusts github.actor,# which is whoever acted on the pull request last.name: Auto-merge Dependabot on: pull_request_target permissions:  contents: write  pull-requests: write jobs:  merge:    if: github.actor == 'dependabot[bot]'    runs-on: ubuntu-latest    steps:      - run: gh pr merge --auto --squash "$PR_URL"        env:          PR_URL: ${{ github.event.pull_request.html_url }}          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}