https://github.com/step-security/action-cond
Conditional value for GitHub Action - missing expression for GitHub Actions
https://github.com/step-security/action-cond
step-security-maintained-actions
Last synced: 2 months ago
JSON representation
Conditional value for GitHub Action - missing expression for GitHub Actions
- Host: GitHub
- URL: https://github.com/step-security/action-cond
- Owner: step-security
- License: mit
- Created: 2024-07-08T10:24:29.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-14T21:15:02.000Z (over 1 year ago)
- Last Synced: 2025-01-01T02:28:26.713Z (over 1 year ago)
- Topics: step-security-maintained-actions
- Language: TypeScript
- Homepage:
- Size: 298 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Conditional value - missing expression for GitHub Actions
```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: step-security/action-cond@v1.2.1
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: step-security/action-cond@v1.2.1
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 }}
```