Skip to content

Instantly share code, notes, and snippets.

@deep5050
Created December 22, 2022 09:45
Show Gist options
  • Save deep5050/47a59f3d034fdfb7fb9546cd86831675 to your computer and use it in GitHub Desktop.
Save deep5050/47a59f3d034fdfb7fb9546cd86831675 to your computer and use it in GitHub Desktop.
book_quotes_on_new_issue
jobs:
comment_quote:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Fetch book quotes
run: |
curl https://raw.githubusercontent.com/<username>/<repository>/master/quotes.json --output quotes.json
- name: Select random quote
run: |
quote=$(jq -r '.quotes[$RANDOM % length] | .quote' quotes.json)
author=$(jq -r '.quotes[$RANDOM % length] | .author' quotes.json)
title=$(jq -r '.quotes[$RANDOM % length] | .title' quotes.json)
echo "\"$quote\" - $author ($title)"
- name: Comment on issue
uses: peter-evans/create-or-update-issue-comment@v2
with:
body: "\"$quote\" - $author ($title)"
issue-number: ${{ github.event.issue.number }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment