Skip to content

Commit

Permalink
Add support for reporting via all jobs status (#7)
Browse files Browse the repository at this point in the history
Allows the action to report using the status of all jobs in the workflow

resolves #4
  • Loading branch information
iRoachie authored Jul 6, 2020
1 parent c451b8f commit d423a0a
Show file tree
Hide file tree
Showing 9 changed files with 4,801 additions and 14,099 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,23 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- run: echo true

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- run: echo true

notify:
runs-on: ubuntu-latest
needs: [test, lint]
if: always()
steps:
- uses: actions/checkout@v2
- name: Test Output
uses: ./ # Uses an action in the root directory
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
if: always()
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 8 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
- run: npm install
- run: npm test

- uses: iRoachie/slack-github-actions@v1.1.1
- uses: iRoachie/slack-github-actions@v2.0.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
Expand All @@ -99,9 +99,11 @@ Here's an example with jobs that run in parallel.

It does a few things:

- Lets us know when a status check didn't succeed (failure or cancel)
- Lets us know when a status check didn't succeed
- If all jobs were successful, we'll send a message at the end

> Note that the status variable is omitted here.

```yaml
name: Test
Expand All @@ -118,12 +120,6 @@ jobs:
- uses: actions/checkout@v2
- run: yarn
- run: yarn test
- uses: iRoachie/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
if: ${{ !success() }}
lint:
name: Eslint
Expand All @@ -132,21 +128,15 @@ jobs:
- uses: actions/checkout@v2
- run: yarn
- run: yarn lint
- uses: iRoachie/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
if: ${{ !success() }}
notify:
Name: Slack
needs: [test, lint]
needs: [test, lint] # We only check after the others jobs have run
if: always() # Always runs even if one of the builds fails
runs-on: ubuntu-latest
steps:
- uses: iRoachie/slack-github-actions@v1.1.1
- uses: iRoachie/slack-github-actions@v2.0.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
2 changes: 0 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ description: A no-config GitHub action that notifies slack of the status of your
inputs:
status:
description: Status of the workflow
required: true
default: Success
runs:
using: node12
main: dist/index.js
Expand Down
Loading

0 comments on commit d423a0a

Please sign in to comment.