Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Dependabot: Enable auto-merge on pull requests. (#8040)
Browse files Browse the repository at this point in the history
* Dependabot: Enable auto-merge on pull requests.

* Update auto-merge dependency list

* Update dependabot documentation and invert the order of the auto-merge action for clarity.
  • Loading branch information
nefeline authored Jan 2, 2023
1 parent e0ca483 commit f5d4f98
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/auto-merge-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Dependabot auto-merge
on: pull_request

permissions:
pull-requests: write
contents: write
repository-projects: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Enable auto-merge for Dependabot PRs
# Automatically merge the following dependency upgrades:
if: "${{ steps.metadata.outputs.dependency-names == '@actions/core' ||
steps.metadata.outputs.dependency-names == '@automattic/color-studio' ||
steps.metadata.outputs.dependency-names == '@babel/cli' ||
steps.metadata.outputs.dependency-names == '@babel/core' ||
steps.metadata.outputs.dependency-names == '@babel/plugin-proposal-class-properties' ||
steps.metadata.outputs.dependency-names == '@babel/plugin-syntax-jsx' ||
steps.metadata.outputs.dependency-names == '@babel/polyfill' ||
steps.metadata.outputs.dependency-names == '@types/classnames' ||
steps.metadata.outputs.dependency-names == '@types/dinero.js' ||
steps.metadata.outputs.dependency-names == '@types/dompurify' ||
steps.metadata.outputs.dependency-names == '@types/gtag.js' ||
steps.metadata.outputs.dependency-names == '@types/jest' ||
steps.metadata.outputs.dependency-names == '@types/jest-environment-puppeteer' ||
steps.metadata.outputs.dependency-names == '@types/jquery' ||
steps.metadata.outputs.dependency-names == '@types/lodash' ||
steps.metadata.outputs.dependency-names == '@types/puppeteer' ||
steps.metadata.outputs.dependency-names == '@types/react' ||
steps.metadata.outputs.dependency-names == '@types/react-dom' ||
steps.metadata.outputs.dependency-names == '@types/wordpress__block-editor' ||
steps.metadata.outputs.dependency-names == '@types/wordpress__blocks' ||
steps.metadata.outputs.dependency-names == '@types/wordpress__data' ||
steps.metadata.outputs.dependency-names == '@types/wordpress__data-controls' ||
steps.metadata.outputs.dependency-names == '@types/wordpress__editor' ||
steps.metadata.outputs.dependency-names == '@types/wordpress__notices' ||
steps.metadata.outputs.dependency-names == '@typescript-eslint/eslint-plugin' ||
steps.metadata.outputs.dependency-names == '@typescript-eslint/parser' ||
steps.metadata.outputs.dependency-names == 'chalk' ||
steps.metadata.outputs.dependency-names == 'circular-dependency-plugin' ||
steps.metadata.outputs.dependency-names == 'commander' ||
steps.metadata.outputs.dependency-names == 'copy-webpack-plugin' ||
steps.metadata.outputs.dependency-names == 'eslint-import-resolver-typescript' ||
steps.metadata.outputs.dependency-names == 'gh-pages' ||
steps.metadata.outputs.dependency-names == 'markdown-it' ||
steps.metadata.outputs.dependency-names == 'promptly' ||
steps.metadata.outputs.dependency-names == 'react-docgen' ||
steps.metadata.outputs.dependency-names == 'wp-types'
}}"

run: |
gh pr edit --add-label 'dependencies-auto-merged' "$PR_URL"
gh pr review --approve "$PR_URL"
gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
6 changes: 6 additions & 0 deletions docs/internal-developers/automations/dependabot.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ The process is automated: Dependabot creates a branch and a PR with a package bu
It is the responsibility of the porter to review these PRs weekly and merge/reject them.

Dependabot's configuration is located at [`.github/dependabot.yml` path](https://github.com/woocommerce/woocommerce-blocks/blob/trunk/.github/dependabot.yml).

## Auto-merge

This repository also has auto-merge enabled for selected dev dependencies. Debendabot will automatically merge pull requests that pass all the required checks and meet the defined merge criteria, helping us to streamline the process of keeping dependencies up to date even further.

The list of dependencies marked for auto-merge can be found at [`.github/workflows/auto-merge-dependabot.yml`](https://github.com/woocommerce/woocommerce-blocks/blob/trunk/.github/workflows/auto-merge-dependabot.yml).

0 comments on commit f5d4f98

Please sign in to comment.