Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haya14busa/action-cond
Conditional value for GitHub Action - missing expression for GitHub Actions
https://github.com/haya14busa/action-cond
Last synced: 6 days ago
JSON representation
Conditional value for GitHub Action - missing expression for GitHub Actions
- Host: GitHub
- URL: https://github.com/haya14busa/action-cond
- Owner: haya14busa
- License: mit
- Created: 2020-01-19T04:53:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-09T14:19:28.000Z (9 months ago)
- Last Synced: 2024-11-07T08:25:30.923Z (13 days ago)
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/conditional-value-for-github-action
- Size: 408 KB
- Stars: 84
- Watchers: 3
- Forks: 12
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Conditional value - missing expression for GitHub Actions
[![test](https://github.com/haya14busa/action-cond/workflows/test/badge.svg)](https://github.com/haya14busa/action-cond/actions?query=workflow%3Atest)
[![reviewdog](https://github.com/haya14busa/action-cond/workflows/reviewdog/badge.svg)](https://github.com/haya14busa/action-cond/actions?query=workflow%3Areviewdog)
[![release](https://github.com/haya14busa/action-cond/workflows/release/badge.svg)](https://github.com/haya14busa/action-cond/actions?query=workflow%3Arelease)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/haya14busa/action-cond?logo=github&sort=semver)](https://github.com/haya14busa/action-cond/releases)```yaml
inputs:
cond:
description: 'condition. [true,false]'
required: true
if_true:
description: 'output value if cond is true'
if_false:
description: 'output value if cond is false'
outputs:
value:
description: 'output value'
```## Usage:
```yaml
steps:
- uses: haya14busa/action-cond@v1
id: condval
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: "value for pull request event"
if_false: "value for non pull request event"
- name: Use conditional value
run: echo "${{ steps.condval.outputs.value }}"
```### Change reviewdog reporter depending on event:
https://github.com/reviewdog/reviewdog
https://github.com/reviewdog/action-eslint```yaml
steps:
- uses: actions/checkout@v1
- uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: "github-pr-review"
if_false: "github-check"
- uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.github_token }}
eslint_flags: 'src/**/*.ts'
reporter: ${{ steps.reporter.outputs.value }}
```