Please tell what is the weather like in Danang? #2
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 | |
on: | |
issues: | |
types: | |
- opened | |
- reopened | |
- labeled | |
jobs: | |
generate-on-issues: | |
if: startsWith(github.event.issue.title, 'Please') || github.event.label.name == 'generate' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: write | |
steps: | |
# Checkout the main branch | |
- uses: actions/checkout@v4 | |
# Uses action in the root directory to generate awesome text | |
- 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 }} | |
- 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: |