From 2e87345ca90b87cbd7aa46a41aa14f9faad4a3aa Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 1 Feb 2023 12:52:18 -0500 Subject: [PATCH] - adds conflicting and auto merge workflows --- .github/workflows/auto-merge-dependabot.yml | 32 +++++++++++++++++++ .github/workflows/conflicting-pr-label.yml | 34 +++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/auto-merge-dependabot.yml create mode 100644 .github/workflows/conflicting-pr-label.yml diff --git a/.github/workflows/auto-merge-dependabot.yml b/.github/workflows/auto-merge-dependabot.yml new file mode 100644 index 00000000..d72e8d31 --- /dev/null +++ b/.github/workflows/auto-merge-dependabot.yml @@ -0,0 +1,32 @@ +name: Auto-merge dependabot updates + +on: + pull_request: + branches: [ main ] + +permissions: + pull-requests: write + contents: write + +jobs: + + dependabot-merge: + + runs-on: ubuntu-latest + + if: ${{ github.actor == 'dependabot[bot]' }} + + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v1.3.6 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - name: Enable auto-merge for Dependabot PRs + # Only if version bump is not a major version change + if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}} + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/conflicting-pr-label.yml b/.github/workflows/conflicting-pr-label.yml new file mode 100644 index 00000000..da6e5f36 --- /dev/null +++ b/.github/workflows/conflicting-pr-label.yml @@ -0,0 +1,34 @@ +# This is a basic workflow to help you get started with Actions + +name: PullRequestConflicting + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ main ] + pull_request: + types: [synchronize] + branches: [ main ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: check if prs are dirty + uses: eps1lon/actions-label-merge-conflict@releases/2.x + if: env.LABELING_TOKEN != '' && env.LABELING_TOKEN != null + id: check + with: + dirtyLabel: "conflicting" + repoToken: "${{ secrets.GITHUB_TOKEN }}" + continueOnMissingPermissions: true + commentOnDirty: 'This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.' + commentOnClean: 'Conflicts have been resolved. A maintainer will take a look shortly.' + env: + LABELING_TOKEN: ${{secrets.GITHUB_TOKEN }}