Skip to content

Bump eslint from 10.9.0 to 10.9.1 #17

Bump eslint from 10.9.0 to 10.9.1

Bump eslint from 10.9.0 to 10.9.1 #17

name: Dependabot auto-merge
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: dependabot-auto-merge-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
authorize-dependency-update:
if: >-
github.event.repository.fork == false &&
github.actor == 'dependabot[bot]' &&
github.event.pull_request.user.login == 'dependabot[bot]' &&
github.event.pull_request.head.repo.full_name == github.repository &&
(startsWith(github.event.pull_request.head.ref, 'dependabot/npm_and_yarn/') ||
startsWith(github.event.pull_request.head.ref, 'dependabot/github_actions/')) &&
github.event.pull_request.base.ref == github.event.repository.default_branch
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- name: Authorize dependency update files
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_REF: ${{ github.event.pull_request.head.ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
case "${HEAD_REF}" in
dependabot/npm_and_yarn/*) ecosystem="npm" ;;
dependabot/github_actions/*) ecosystem="github-actions" ;;
*)
echo "Refusing auto-merge; unsupported Dependabot branch: ${HEAD_REF}"
exit 1
;;
esac
changed_files="$(gh api --paginate \
"repos/${REPOSITORY}/pulls/${PR_NUMBER}/files?per_page=100" \
--jq '.[].filename')"
if [[ -z "${changed_files}" ]]; then
echo "Refusing auto-merge; the pull request has no changed files."
exit 1
fi
while IFS= read -r changed_file; do
case "${ecosystem}:${changed_file}" in
npm:package.json | npm:package-lock.json) ;;
github-actions:.github/workflows/*.yml | github-actions:.github/workflows/*.yaml) ;;
github-actions:action.yml | github-actions:action.yaml) ;;
*)
echo "Refusing auto-merge; changed files were:"
echo "${changed_files}"
exit 1
;;
esac
done <<< "${changed_files}"
enable-auto-merge:
needs: authorize-dependency-update
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Enable auto-merge
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: gh pr merge --auto --squash --match-head-commit "${HEAD_SHA}" "${PR_URL}"
disable-auto-merge:
if: >-
always() &&
needs.authorize-dependency-update.result != 'success' &&
github.event.repository.fork == false &&
github.event.pull_request.user.login == 'dependabot[bot]' &&
github.event.pull_request.head.repo.full_name == github.repository &&
(startsWith(github.event.pull_request.head.ref, 'dependabot/npm_and_yarn/') ||
startsWith(github.event.pull_request.head.ref, 'dependabot/github_actions/')) &&
github.event.pull_request.base.ref == github.event.repository.default_branch
needs: authorize-dependency-update
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Disable an existing auto-merge request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
set -euo pipefail
auto_merge_enabled="$(gh pr view "${PR_URL}" --json autoMergeRequest --jq '.autoMergeRequest != null')"
if [[ "${auto_merge_enabled}" == true ]]; then
gh pr merge --disable-auto "${PR_URL}"
else
echo "Auto-merge is not enabled."
fi