From 4c9af6b67798f97246223801a631093dd38852e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Mickevi=C4=8Dius?= Date: Sun, 5 May 2024 07:49:57 +0300 Subject: [PATCH] Use GH CLI to autoapprove depencency PRs --- .github/release-drafter.yml | 5 ++++ .github/workflows/auto-approve.yaml | 21 +++++++++++++++ .github/workflows/release-drafter.yml | 1 + .mergify.yml | 38 --------------------------- .yamllint | 3 +++ 5 files changed, 30 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/auto-approve.yaml delete mode 100644 .mergify.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 87b3410..dd9065b 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -11,3 +11,8 @@ categories: collapse-after: 3 labels: - dependencies + +autolabeler: +- label: 'dependencies' + branch: + - '/update\/.+/' diff --git a/.github/workflows/auto-approve.yaml b/.github/workflows/auto-approve.yaml new file mode 100644 index 0000000..3a46e82 --- /dev/null +++ b/.github/workflows/auto-approve.yaml @@ -0,0 +1,21 @@ +name: Auto approve and merge dependency bump PRs + +on: pull_request + +permissions: + contents: write + pull-requests: write + +jobs: + auto-approve: + runs-on: ubuntu-latest + if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'scala-steward' + steps: + - run: gh pr review --approve "$PR_URL" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ github.event.pull_request.html_url }} + - run: gh pr merge --auto --squash "$PR_URL" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ github.event.pull_request.html_url }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 87601fe..1759e1a 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -4,6 +4,7 @@ on: # yamllint disable-line rule:truthy push: branches: - main + workflow_dispatch: jobs: update_release_draft: diff --git a/.mergify.yml b/.mergify.yml deleted file mode 100644 index 3705687..0000000 --- a/.mergify.yml +++ /dev/null @@ -1,38 +0,0 @@ -pull_request_rules: -- name: Merge PRs from Scala Steward that pass validation - conditions: - - status-success~=Format and style checks - - status-success~=Compile and test - - author=scala-steward - actions: - merge: - method: merge - -- name: Merge PRs from dependabot that pass validation - conditions: - - status-success~=Format and style checks - - status-success~=Compile and test - - author=dependabot[bot] - actions: - merge: - method: merge - -- name: Label Scala Steward PRs - conditions: - - author=scala-steward - actions: - label: - add: ["dependencies"] - -- name: Label dependabot PRs - conditions: - - author=dependabot[bot] - actions: - label: - add: ["dependencies"] - -- name: Delete the PR branch after merge - conditions: - - merged - actions: - delete_head_branch: {} diff --git a/.yamllint b/.yamllint index 30b227b..859de7a 100644 --- a/.yamllint +++ b/.yamllint @@ -11,3 +11,6 @@ rules: line-length: max: 100 level: warning + + truthy: + allowed-values: ['true', 'false', 'on']