Skip to content

Commit

Permalink
Switch action to composite run (#3)
Browse files Browse the repository at this point in the history
* Switch action to composite run

* Update README
  • Loading branch information
martialonline authored Oct 22, 2020
1 parent 365f961 commit 3a2fcc7
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 84 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,25 @@ on:
push:
branches:
- master
paths-ignore:
- 'license'
- '**.md'
pull_request:
branches:
- master
paths-ignore:
- 'license'
- '**.md'
types:
- opened
- reopened
- synchronize

jobs:

build:
name: Build
runs-on: ubuntu-18.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Build action
run: make build.docker VERSION=${{ github.sha }}

test:
name: Test-Script
runs-on: ubuntu-18.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Test Script
run: make test.shell

test-action:
name: Test-Action
runs-on: ubuntu-18.04
needs: [build, test]
continue-on-error: true
steps:
- name: Checkout Repository
Expand Down
10 changes: 0 additions & 10 deletions Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions Makefile

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Simply add a job to the end of your workflow and list the last job as dependency
needs: [build]
if: always()
steps:
- uses: martialonline/workflow-status@v1
- uses: martialonline/workflow-status@v2
id: check
- run: echo "Workflow failed"
if: steps.check.outputs.status == 'failure'
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
needs: [build]
if: always()
steps:
- uses: martialonline/workflow-status@v1
- uses: martialonline/workflow-status@v2
id: check
- uses: 8398a7/action-slack@v3
with:
Expand Down
39 changes: 31 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
name: 'Workflow Status Action'
description: 'Trigger events like notifications or alerts using the workflow status'
author: 'David Boenig <martialonline>'
name: "Workflow Status Action"
description: "Trigger events like notifications or alerts using the workflow status"
author: "David Boenig <martialonline>"

outputs:
status:
description: 'Returns either success or failed as workflow status'
description: "Returns either success or failed as workflow status"
value: ${{ steps.workflow-status.outputs.status }}
runs:
using: 'docker'
image: 'Dockerfile'
env:
DOCKER_BUILDKIT: '1'
using: "composite"
steps:
- id: workflow-status
run: |
url="${GITHUB_API_URL}/repos"
repo="${GITHUB_REPOSITORY}"
run_id="${GITHUB_RUN_ID}"
failure=$(curl -s "${url}/${repo}/actions/runs/${run_id}/jobs" | \
jq -r '.jobs[] | select(.status == "completed" and .conclusion == "failure").conclusion' | \
wc -l)
cancelled=$(curl -s "${url}/${repo}/actions/runs/${run_id}/jobs" | \
jq -r '.jobs[] | select(.status == "completed" and .conclusion == "cancelled").conclusion' | \
wc -l)
if [ "${failure}" -gt 0 ]; then
status="failure"
elif [ "${cancelled}" -gt 0 ]; then
status="cancelled"
else
status="success"
fi
echo "::set-output name=status::${status}"
shell: bash
branding:
icon: check-square
color: gray-dark
25 changes: 0 additions & 25 deletions entrypoint.sh

This file was deleted.

0 comments on commit 3a2fcc7

Please sign in to comment.