diff --git a/.github/workflows/chatops.yml b/.github/workflows/chatops.yml index ff8d3513..a107a407 100644 --- a/.github/workflows/chatops.yml +++ b/.github/workflows/chatops.yml @@ -5,17 +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 }} - dispatch_type: workflow 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/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 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' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5324e895..1cecc97f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,13 +2,13 @@ name: merge on: push: - barnches: + branches: - main 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'