From 7b0be1892375e56623a8f8d1d9ccd661a8e074b0 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Sat, 27 May 2023 11:40:06 +0200 Subject: [PATCH] Setup dependabot automerge --- .github/workflows/dependabot-automerge.yml | 28 ++++++++++++++++++++++ .github/workflows/sonar.yml | 4 ++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/dependabot-automerge.yml diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml new file mode 100644 index 0000000..aca4921 --- /dev/null +++ b/.github/workflows/dependabot-automerge.yml @@ -0,0 +1,28 @@ +name: Dependabot auto merge +on: + workflow_run: + workflows: [CI] + types: + - completed + +jobs: + automerge: + name: Auto merge "${{ github.event.workflow_run.head_branch }}" + runs-on: ubuntu-22.04 + if: > + github.event.workflow_run.event == 'pull_request' + && github.event.workflow_run.conclusion == 'success' + && github.actor == 'dependabot[bot]' + && startsWith(github.event.workflow_run.head_branch, 'dependabot/') + steps: + - name: Checkout source + uses: actions/checkout@v3.5.2 + with: + ref: ${{ github.event.workflow_run.head_commit.id }} + + - name: Instruct @dependabot to merge + run: "gh issue comment $ISSUE_ID --body \"(This is an automated comment from workflow $WORKFLOW_URL)\n\n@dependabot squash and merge\"" + env: + GITHUB_TOKEN: ${{ secrets.DEPENDABOT_COMMENT_TOKEN }} + ISSUE_ID: ${{ github.event.workflow_run.pull_requests[0].number }} + WORKFLOW_URL: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} \ No newline at end of file diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 0e511d1..e1224e5 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -1,4 +1,4 @@ -name: Sonar +name: Sonar scan on: workflow_run: @@ -7,7 +7,7 @@ on: jobs: sonar: - name: Sonar + name: Sonar scan on "${{ github.event.workflow_run.head_branch }}" runs-on: ubuntu-latest if: github.event.workflow_run.conclusion == 'success'