日本語版のガイドはこちらです。
Choose one randomly from multiple user inputs
steps:
- uses: ddradar/choose-random-action@v3.0.0
id: act # required to reference output
with:
contents: |
foo
bar
baz
weights: |
2
3
5
- name: Echo outputs
run: echo ${{ steps.act.outputs.selected }} # foo: 20%, bar: 30%, baz: 50%
Use with Post LGTM Image
name: Send LGTM Image
on:
issue_comment:
types: [created]
pull_request_review:
types: [submitted]
jobs:
post:
runs-on: ubuntu-latest
if: (!contains(github.actor, '[bot]')) # Exclude bot comment
steps:
- uses: ddradar/choose-random-action@v3.0.0
id: act
with:
contents: |
https://example.com/your-lgtm-image-1.jpg
https://example.com/your-lgtm-image-2.jpg
https://example.com/your-lgtm-image-3.jpg
- uses: ddradar/lgtm-action@v3
with:
image-url: ${{ steps.act.outputs.selected }}
Required.
String choices you want to choose randomly.
Optional.
Set natural integer if you want to weight the choices. Make it the same length as the contents. By default, all content has equal weight.
See guide.