From 9ebb8213d5ec60ba8c170bf6ddafe5ab683aeab3 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 14 May 2020 04:06:45 +0200 Subject: [PATCH] Update workflows --- .github/workflows/automerge.yml | 40 +++++++++++--------------- .github/workflows/{dev.yml => ncc.yml} | 10 +++++-- 2 files changed, 23 insertions(+), 27 deletions(-) rename .github/workflows/{dev.yml => ncc.yml} (89%) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 74a0555..702f8e0 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -3,10 +3,12 @@ name: automerge on: pull_request: types: - - labeled - - unlabeled - - synchronize + - reopened - unlocked + - unlabeled + pull_request_review: + types: + - submitted check_suite: types: - completed @@ -18,29 +20,19 @@ jobs: if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' steps: - - name: Approve + name: Automerge + uses: pascalgn/automerge-action@v0.8.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MERGE_METHOD: squash + MERGE_COMMIT_MESSAGE: automatic + - + name: Dispatch event uses: actions/github-script@0.9.0 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | - await github.pulls.createReview({ - owner: context.payload.repository.owner.login, - repo: context.payload.repository.name, - pull_number: context.payload.pull_request.number, - event: 'APPROVE' - }) - - - name: Wait - run: sleep 3 - - - name: Merge - uses: actions/github-script@0.9.0 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - await github.pulls.merge({ - owner: context.payload.repository.owner.login, - repo: context.payload.repository.name, - pull_number: context.payload.pull_request.number, - merge_method: 'squash' + github.repos.createDispatchEvent({ + ...context.repo, + event_type: 'ncc' }) diff --git a/.github/workflows/dev.yml b/.github/workflows/ncc.yml similarity index 89% rename from .github/workflows/dev.yml rename to .github/workflows/ncc.yml index e56d907..dd27c05 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/ncc.yml @@ -1,6 +1,9 @@ -name: dev +name: ncc on: + repository_dispatch: + types: + - 'ncc' push: branches: - 'dev' @@ -8,7 +11,7 @@ on: - '**.md' jobs: - prune: + ncc: runs-on: ubuntu-latest steps: - @@ -28,7 +31,8 @@ jobs: git config user.name GitHub git config user.email noreply@github.com git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git - - name: Commit and push changes + - + name: Commit and push changes run: | git add . if output=$(git status --porcelain) && [ ! -z "$output" ]; then