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 e671971 commit ee2dbda
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 64 deletions.
85 changes: 22 additions & 63 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 🤖 Auto approve validation
on: pull_request

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

jobs:
setup:
Expand All @@ -17,13 +17,11 @@ jobs:
needs: [setup]
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
value: ${{ fromJSON(needs.setup.outputs.matrix) }}
steps:
- run: |
echo "${{ matrix.value }}"
- name: Wait for "${{ matrix.value }}" job to succeed
uses: fountainhead/[email protected]
- uses: fountainhead/[email protected]
id: waiter
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -36,74 +34,35 @@ jobs:
if: steps.waiter.outputs.conclusion == 'success'
run: echo 'success'

- name: Do something with a failing build
- uses: actions/github-script@v5
if: steps.waiter.outputs.conclusion == 'failure'
run: echo 'failure'
continue-on-error: true
with:
github-token: ${{ github.token }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '⛔ ${{ matrix.value }} job has failed!'
})
- if: steps.waiter.outputs.conclusion == 'failure'
run: exit 1

result:
needs: [wait]
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'

- run: echo 'cool'
- uses: taiga-family/ci/actions/auto/approve/[email protected]
if: env.TAIGA_FAMILY_BOT_IS_AUTHOR == 'true'
with:
token1: ${{ secrets.GITHUB_TOKEN }}
token2: ${{ secrets.TAIGA_FAMILY_APPROVE_BOT_PAT }}

concurrency:
group: auto-approve-${{ github.head_ref }}
cancel-in-progress: true
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: taiga-family/ci/actions/setup/[email protected]
- uses: taiga-family/ci/actions/setup/[email protected]
- uses: taiga-family/ci/actions/setup/[email protected]
- run: npm run typecheck
- run: npm run typecheck2
- run: npm run prettier -- --check
- run: npm run stylelint
- run: npm run lint
Expand Down

0 comments on commit ee2dbda

Please sign in to comment.