Skip to content

Commit

Permalink
ci: approve on success
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Oct 5, 2023
1 parent 37ffd17 commit e51b2aa
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 43 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,107 @@
name: 🤖 Auto approve by bot
on: pull_request

env:
JOBS_NAME: '["build", "build-demo", "lint", "tests"]'

jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.value }}
steps:
- id: matrix
run: echo "value=$JOBS_NAME" >> $GITHUB_OUTPUT

wait-checks:
needs: [setup]
runs-on: ubuntu-latest
strategy:
matrix:
value: ${{ fromJSON(needs.setup.outputs.matrix) }}
steps:
- run: |
echo "${{ matrix.value }}"
- name: Wait for "${{ matrix.value }}" job to succeed
uses: fountainhead/[email protected]
id: waiter
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: build
ref: ${{ github.event.pull_request.head.sha || github.sha }}
timeoutSeconds: 3600
intervalSeconds: 60

- name: Do something with a passing build
if: steps.waiter.outputs.conclusion == 'success'
run: echo 'success'

- name: Do something with a failing build
if: steps.waiter.outputs.conclusion == 'failure'
run: echo 'failure'

result:
needs: [wait-checks]
runs-on: ubuntu-latest
steps:
- run: |
echo "approve"
automated-pull-request:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: taiga-family/ci/actions/setup/[email protected]
- uses: taiga-family/ci/actions/setup/[email protected]
- name: Wait for build to succeed
uses: fountainhead/[email protected]
id: wait1
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: build
ref: ${{ github.event.pull_request.head.sha || github.sha }}
timeoutSeconds: 3600
intervalSeconds: 60
- name: Wait for build to succeed
if: steps.wait1.outputs.conclusion == 'success'
uses: fountainhead/[email protected]
id: wait2
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: build-demo
ref: ${{ github.event.pull_request.head.sha || github.sha }}
timeoutSeconds: 3600
intervalSeconds: 60
- name: Wait for build to succeed
if: steps.wait2.outputs.conclusion == 'success'
uses: fountainhead/[email protected]
id: wait3
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: lint
ref: ${{ github.event.pull_request.head.sha || github.sha }}
timeoutSeconds: 3600
intervalSeconds: 60
- name: Wait for build to succeed
if: steps.wait3.outputs.conclusion == 'success'
uses: fountainhead/[email protected]
id: wait-for-build
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: tests
ref: ${{ github.event.pull_request.head.sha || github.sha }}
timeoutSeconds: 3600
intervalSeconds: 60

- name: Do something with a passing build
if: steps.wait-for-build.outputs.conclusion == 'success'
run: echo 'success'

- name: Do something with a failing build
if: steps.wait-for-build.outputs.conclusion == 'failure'
run: echo 'failure'

- uses: taiga-family/ci/actions/auto/approve/[email protected]
if: env.TAIGA_FAMILY_BOT_IS_AUTHOR == 'true'
with:
Expand Down
39 changes: 0 additions & 39 deletions .github/workflows/auto-wait-successful.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
build:
build-demo:
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected]
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
jobs:
build:
runs-on: ubuntu-latest
name: Build libs
steps:
- uses: taiga-family/ci/actions/setup/[email protected]
- uses: taiga-family/ci/actions/setup/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ⚙️ E2E
on:
workflow_dispatch:
pull_request:

env:
CYPRESS_failOnSnapshotDiff: 0
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:

jobs:
tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected]
Expand Down

0 comments on commit e51b2aa

Please sign in to comment.