Please tell me how to become a musician? #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: generate-on-issues | |
# Run when new issues created or with label | |
on: | |
issues: | |
types: | |
- opened | |
- reopened | |
- labeled | |
jobs: | |
generate_on_issues: | |
if: startsWith(github.event.issue.title, 'Please') || github.event.label.name == 'generate' | |
name: Generate with title of issue starts with Please or with label generate | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: write | |
steps: | |
# Checkout the main branch | |
- uses: actions/checkout@v4 | |
# Use action to generate awesome text with Google's Gemini model | |
- name: Generate awesome text | |
uses: huuquyet/generate-awesome-text@main | |
env: | |
GEMINI_API_TOKEN: ${{ secrets.GEMINI_API_TOKEN }} | |
with: | |
prompt: ${{ github.event.issue.title }} | |
# user: ${{ github.event.issue.user.login }} | |
# Push awesome text to main branch | |
# Note: the following account information will not work on GHES | |
- name: Push the awesome text to main branch | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m ":robot: Generated by @$USER (#$NUMBER)" | |
git push | |
env: | |
NUMBER: ${{ github.event.issue.number }} | |
USER: ${{ github.event.issue.user.login }} | |
# Add comment the result to created issue | |
- name: Add comment | |
run: | | |
gh issue comment "$NUMBER" --body "$BODY" | |
gh issue close "$NUMBER" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
NUMBER: ${{ github.event.issue.number }} | |
BODY: > | |
Done! | |
**Your request was generated** | |
:sparkles: Thank you for your contribution! :sparkles: |