Skip to content

[DEVOPS-269] Lint PR for Jira issue key before Jira linter #89

[DEVOPS-269] Lint PR for Jira issue key before Jira linter

[DEVOPS-269] Lint PR for Jira issue key before Jira linter #89

name: Dependabot Automations
on:
pull_request_target:
types: [opened, synchronize, reopened]
workflow_call:
inputs:
autoApprove:
default: "false"
description: Array of version update to automatically approve (for ex. '["version-update:semver-major", "version-update:semver-minor"]')
type: string
autoMerge:
default: "false"
description: Array of version update to automatically merge in (for ex. '["version-update:semver-major", "version-update:semver-minor"]')
type: string
jobs:
dependabot-automations:
name: Dependabot Automations
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' && inputs.autoApprove != 'false' || inputs.autoMerge != 'false' }}
steps:
- name: Checkout
uses: actions/checkout@v3
# The approval step will fail if there's no metadata.
- name: Retrieve dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve PR
if: ${{ contains(fromJson(inputs.autoApprove), steps.dependabot-metadata.outputs.update-type) }}
uses: hmarr/auto-approve-action@v3
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge
if: ${{ contains(fromJson(inputs.autoMerge), steps.dependabot-metadata.outputs.update-type) }}
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
gh pr merge --auto --squash "${PR_URL}"