Skip to content

[DEVOPS-XXX] Switching over to new cache-azure-login action #53

[DEVOPS-XXX] Switching over to new cache-azure-login action

[DEVOPS-XXX] Switching over to new cache-azure-login action #53

name: Dependabot Automations
on:
pull_request_target:
types: [opened, synchronize, reopened]
workflow_call:
inputs:
autoApprove:
default: false
type: boolean
autoMerge:
default: false
type: boolean
jobs:
dependabot-automations:
name: Automatically Update Dependencies
runs-on: ubuntu-latest
# Checking the actor will prevent your Action run failing on non-Dependabot
# PRs but also ensures that it only does work for Dependabot PRs.
if: ${{ inputs.autoApprove || inputs.autoMerge && github.actor == 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v3
# This second step will fail if there's no metadata and so the approval
# will not occur.
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Auto Approve Dependabot PRs
uses: hmarr/auto-approve-action@v3.2.1
if: ${{ inputs.autoApprove && github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' }}
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: ${{ inputs.autoMerge && steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}