From 22beb6398c388ef75c19be443da7937648f316b5 Mon Sep 17 00:00:00 2001 From: sbertix Date: Tue, 11 May 2021 15:43:17 +0200 Subject: [PATCH 1/5] ci(actions): fix typo in `chatops.yml` --- .github/workflows/chatops.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/chatops.yml b/.github/workflows/chatops.yml index ff8d3513..1b192450 100644 --- a/.github/workflows/chatops.yml +++ b/.github/workflows/chatops.yml @@ -15,7 +15,6 @@ jobs: uses: peter-evans/slash-command-dispatch@v2 with: token: ${{ secrets.CHATOPS_PAT }} - dispatch_type: workflow commands: | merge test From 58f1a0943706dc4b81ddb2c4f2698ad943331721 Mon Sep 17 00:00:00 2001 From: sbertix Date: Tue, 11 May 2021 15:44:54 +0200 Subject: [PATCH 2/5] ci(actions): fix typo in `push.yml` --- .github/workflows/push.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 7e4d0fc7..7b6f57eb 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -38,8 +38,8 @@ jobs: - uses: dorny/paths-filter@v2 id: changes with: - base: ${{ github.event.pull_request.base.sha ?? github.event.push.before }} - ref: ${{ github.event.pull_request.head.sha ?? github.event.push.head }} + base: ${{ github.event.pull_request.base.sha || github.event.push.before }} + ref: ${{ github.event.pull_request.head.sha || github.event.push.head }} filters: | src: - '**/*.swift' @@ -61,8 +61,8 @@ jobs: - uses: dorny/paths-filter@v2 id: changes with: - base: ${{ github.event.pull_request.base.sha ?? github.event.push.before }} - ref: ${{ github.event.pull_request.head.sha ?? github.event.push.head }} + base: ${{ github.event.pull_request.base.sha || github.event.push.before }} + ref: ${{ github.event.pull_request.head.sha || github.event.push.head }} filters: | src: - '**/*.swift' From c880b8d04401e2846f8909f583f956a02035d219 Mon Sep 17 00:00:00 2001 From: sbertix Date: Tue, 11 May 2021 16:24:25 +0200 Subject: [PATCH 3/5] ci(actions): remove `merge.yml` --- .github/workflows/merge.yml | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 .github/workflows/merge.yml diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml deleted file mode 100644 index 22dbd76a..00000000 --- a/.github/workflows/merge.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: merge - -on: - repository_dispatch: - types: - - merge-command - -jobs: - test: - name: Merge - runs-on: ubuntu-latest - - steps: - # checkout the current PR of `ComposableRequest`. - - name: Checkout - uses: actions/checkout@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} - ref: ${{ github.event.client_payload.pull_request.head.sha }} - # config author. - - name: Config - id: config - run: | - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config user.name "github-actions" - # rebase `base` into `head`. - - name: Rebase - run: | - git checkout -b test - git rebase ${{ github.event.client_payload.pull_request.base.sha }} - # merge `head` into `base`. - - name: Merge - run: | - git checkout -b ${{ github.event.client_payload.pull_request.base.ref }} origin/${{ github.event.client_payload.pull_request.base.ref }} - git merge test -m "chore(merge): merge #${{ github.event.client_payload.pull_request.number }} into \`${{ github.event.client_payload.pull_request.base.ref }}\`" --no-ff - git push origin ${{ github.event.client_payload.pull_request.base.ref }} --force-with-lease From ef459e2c8f7f8e59f20399d3f4b6d4cbf665aff7 Mon Sep 17 00:00:00 2001 From: sbertix Date: Tue, 11 May 2021 16:26:23 +0200 Subject: [PATCH 4/5] ci(actions): refactor `test-command.yml` --- .github/workflows/chatops.yml | 21 ++++++++++++++---- .github/workflows/release.yml | 6 ++--- .../workflows/{test.yml => test-command.yml} | 22 +++++++++++++------ 3 files changed, 35 insertions(+), 14 deletions(-) rename .github/workflows/{test.yml => test-command.yml} (64%) diff --git a/.github/workflows/chatops.yml b/.github/workflows/chatops.yml index 1b192450..a107a407 100644 --- a/.github/workflows/chatops.yml +++ b/.github/workflows/chatops.yml @@ -5,16 +5,29 @@ on: types: [created] jobs: - chatops: - name: ChatOps + workflows: + name: ChatOps (Workflows) runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} steps: # launch workflows with specific instructions. - - name: ChatOps + - name: ChatOps (Repository) uses: peter-evans/slash-command-dispatch@v2 with: token: ${{ secrets.CHATOPS_PAT }} commands: | - merge test + static-args: | + repo=${{ github.pull_request.head.repo.full_name }} + head=${{ github.pull_request.head.sha }} + base=${{ github.pull_request.base.sha }} + dispatch-type: workflow + # append error message. + - name: Edit comment with error message + if: steps.scd.outputs.error-message + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ github.event.comment.id }} + body: | + > ${{ steps.scd.outputs.error-message }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5324e895..92014fe3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ on: jobs: # rebase `bugfixes` and `development` on merged PRs. rebase: - name: rebase + name: Rebase runs-on: ubuntu-latest if: ${{ github.event.pull_request.merged == true }} @@ -43,7 +43,7 @@ jobs: # release a new version. release: - name: release + name: Release runs-on: ubuntu-latest if: ${{ github.event.pull_request.merged == true }} @@ -95,7 +95,7 @@ jobs: # create docs. docs: - name: docs + name: Docs needs: release runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test-command.yml similarity index 64% rename from .github/workflows/test.yml rename to .github/workflows/test-command.yml index 97ede1f0..4f63aa9a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test-command.yml @@ -1,9 +1,17 @@ name: test on: - repository_dispatch: - types: - - test-command + workflow_dispatch: + inputs: + repo: + description: '' + required: true + head: + description: '' + required: true + base: + description: '' + required: true jobs: test: @@ -16,14 +24,14 @@ jobs: uses: actions/checkout@v2 with: token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} - ref: ${{ github.event.client_payload.pull_request.head.sha }} + repository: ${{ github.event.inputs.repo }} + ref: ${{ github.event.inputs.head }} # filter updates. - uses: dorny/paths-filter@v2 id: changes with: - base: ${{ github.event.client_payload.pull_request.base.sha }} - ref: ${{ github.event.client_payload.pull_request.head.sha }} + base: ${{ github.event.inputs.base }} + ref: ${{ github.event.inputs.head }} filters: | src: - '**/*.swift' From 5ecccba471f285cfd2f0467ec5ab53361ff30be2 Mon Sep 17 00:00:00 2001 From: sbertix Date: Tue, 11 May 2021 16:17:42 +0200 Subject: [PATCH 5/5] ci(actions): fix typo in `release.yml` --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92014fe3..1cecc97f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: merge on: push: - barnches: + branches: - main jobs: