Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
feat: Build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 19, 2020
1 parent e48fa66 commit 710f17a
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 11 deletions.
87 changes: 87 additions & 0 deletions README.ja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Workflow Conclusion Action

[![CI Status](https://github.com/technote-space/workflow-conclusion-action/workflows/CI/badge.svg)](https://github.com/technote-space/workflow-conclusion-action/actions)
[![codecov](https://codecov.io/gh/technote-space/workflow-conclusion-action/branch/master/graph/badge.svg)](https://codecov.io/gh/technote-space/workflow-conclusion-action)
[![CodeFactor](https://www.codefactor.io/repository/github/technote-space/workflow-conclusion-action/badge)](https://www.codefactor.io/repository/github/technote-space/workflow-conclusion-action)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/technote-space/workflow-conclusion-action/blob/master/LICENSE)

*Read this in other languages: [English](README.md), [日本語](README.ja.md).*

これはワークフローの結果を取得するための`GitHub Actions`です。

## Table of Contents

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
<details>
<summary>Details</summary>

- [使用方法](#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95)
- [Success](#success)
- [Failure](#failure)
- [Author](#author)

</details>
<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## 使用方法
例:Lint => Test => Publish (タグ付与時のみ) => slack (いずれかのジョブが失敗した場合のみ)
```yaml
on: push

name: CI

jobs:
lint:
name: ESLint
runs-on: ubuntu-latest
...

test:
name: Coverage
needs: lint
strategy:
matrix:
node: ['11', '12']
...

publish:
name: Publish Package
needs: test
if: startsWith(github.ref, 'refs/tags/v')
...

slack:
name: Slack
needs: publish # set needs only last job except this job
runs-on: ubuntu-latest
if: always() # set always
steps:
# run this action to get workflow conclusion
# You can get conclusion by env (env.WORKFLOW_CONCLUSION)
- uses: technote-space/workflow-conclusion-action@gh-actions
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: 8398a7/action-slack@v2
with:
# status: ${{ env.WORKFLOW_CONCLUSION }} # skipped, success, cancelled, failure
status: failure
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure
```

### Success
![Success](https://raw.githubusercontent.com/technote-space/workflow-conclusion-action/images/success.png)

すべてのジョブが正常だったため、Slackアクションはスキップされます。

### Failure
![Failure](https://raw.githubusercontent.com/technote-space/workflow-conclusion-action/images/failure.png)

いくつかのジョブがスキップされた場合でもSlackアクションは実行されます。

## Author
[GitHub (Technote)](https://github.com/technote-space)
[Blog](https://technote.space)
70 changes: 61 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![CodeFactor](https://www.codefactor.io/repository/github/technote-space/workflow-conclusion-action/badge)](https://www.codefactor.io/repository/github/technote-space/workflow-conclusion-action)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/technote-space/workflow-conclusion-action/blob/master/LICENSE)

GitHub action to wait for other actions to finish.
GitHub action to get workflow conclusion.

## Table of Contents

Expand All @@ -14,19 +14,71 @@ GitHub action to wait for other actions to finish.
<details>
<summary>Details</summary>

- [Setup](#setup)
- [yarn](#yarn)
- [npm](#npm)
- [Usage](#usage)
- [Success](#success)
- [Failure](#failure)
- [Author](#author)

</details>
<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Setup
### yarn
- `yarn setup`
### npm
- `npm run setup`
## Usage
e.g. Lint => Test => Publish (only tagged) => slack (only if any job fails)
```yaml
on: push

name: CI

jobs:
lint:
name: ESLint
runs-on: ubuntu-latest
...

test:
name: Coverage
needs: lint
strategy:
matrix:
node: ['11', '12']
...

publish:
name: Publish Package
needs: test
if: startsWith(github.ref, 'refs/tags/v')
...

slack:
name: Slack
needs: publish # set needs only last job except this job
runs-on: ubuntu-latest
if: always() # set always
steps:
# run this action to get workflow conclusion
# You can get conclusion by env (env.WORKFLOW_CONCLUSION)
- uses: technote-space/workflow-conclusion-action@gh-actions
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: 8398a7/action-slack@v2
with:
# status: ${{ env.WORKFLOW_CONCLUSION }} # skipped, success, cancelled, failure
status: failure
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure
```

### Success
![Success](https://raw.githubusercontent.com/technote-space/workflow-conclusion-action/images/success.png)

Slack action step is skipped because all jobs are success.

### Failure
![Failure](https://raw.githubusercontent.com/technote-space/workflow-conclusion-action/images/failure.png)

Slack action step has been executed even if some jobs were skipped.

## Author
[GitHub (Technote)](https://github.com/technote-space)
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Workflow Conclusion Action

description: GitHub action to wait for other actions to finish.
description: GitHub action to get workflow conclusion.

author: technote-space

Expand Down
2 changes: 1 addition & 1 deletion build.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"owner":"technote-space","repo":"workflow-conclusion-action","sha":"01a5001a94e12cab9856b40c0a1477d4e2824756","ref":"refs/tags/test/v1.0.0.2","tagName":"test/v1.0.0.2","branch":"gh-actions","tags":["test/v1.0.0.2","test/v1.0.0","test/v1.0","test/v1"],"updated_at":"2020-02-19T17:22:19.108Z"}
{"owner":"technote-space","repo":"workflow-conclusion-action","sha":"5892d2c85b6ba82d35c419fab4d5158b25447bec","ref":"refs/tags/v1.0.0","tagName":"v1.0.0","branch":"gh-actions","tags":["v1.0.0","v1.0","v1"],"updated_at":"2020-02-19T18:32:14.088Z"}

0 comments on commit 710f17a

Please sign in to comment.