Skip to content

Bump peter-murray/workflow-application-token-action from 3.0.0 to 3.0.1 #355

Bump peter-murray/workflow-application-token-action from 3.0.0 to 3.0.1

Bump peter-murray/workflow-application-token-action from 3.0.0 to 3.0.1 #355

name: dependabot-approve
on: pull_request_target
permissions:
contents: read
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
steps:
- name: Get dependabot metadata
uses: dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 # v2.2.0
id: dependabot-metadata
- name: Generate GitHub application token
id: generate-application-token
uses: peter-murray/workflow-application-token-action@baa1ef2638c3d9e5967b7c8b86219f8fc919e1bb # v3.0.1
with:
application_id: ${{ secrets.REVIEWER_APPLICATION_ID }}
application_private_key: ${{ secrets.REVIEWER_APPLICATION_PRIVATE_KEY }}
permissions: "contents:write, pull_requests:write"
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Approve pull request and enable auto-merge
shell: bash
if: |
contains(steps.dependabot-metadata.outputs.dependency-names, 'actions/checkout') ||
contains(steps.dependabot-metadata.outputs.dependency-names, 'actions/dependency-review-action') ||
contains(steps.dependabot-metadata.outputs.dependency-names, 'actions/setup-dotnet') ||
contains(steps.dependabot-metadata.outputs.dependency-names, 'actions/setup-node') ||
contains(steps.dependabot-metadata.outputs.dependency-names, 'actions/upload-artifact') ||
contains(steps.dependabot-metadata.outputs.dependency-names, 'dependabot/fetch-metadata') ||
contains(steps.dependabot-metadata.outputs.dependency-names, 'github/codeql-action') ||
contains(steps.dependabot-metadata.outputs.dependency-names, 'Microsoft.NET.Test.Sdk')
env:
GH_TOKEN: ${{ steps.generate-application-token.outputs.token }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
gh pr checkout "$PR_URL"
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ];
then gh pr review --approve "$PR_URL" && gh pr merge --auto --squash "$PR_URL"
fi