✍️ Zephyr's Journey: The Essence of Humanity #430
This file contains 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: "Prompt Generator" | |
on: | |
issues: | |
types: [labeled] | |
jobs: | |
generate-story: | |
runs-on: ubuntu-latest | |
if: github.event.label.name == 'story' | |
outputs: | |
url: ${{ steps.build.outputs.url }} | |
title: ${{ steps.build.outputs.title }} | |
permissions: | |
contents: write | |
steps: | |
- name: Parse Issue Body | |
id: parse_prompt | |
uses: peter-murray/issue-forms-body-parser@v4.1.0 | |
with: | |
issue_id: ${{ github.event.issue.number }} | |
separator: "###" | |
label_marker_start: "_" | |
label_marker_end: "_" | |
- uses: actions/checkout@v4 | |
- name: Write story data | |
run: echo ${{ toJson(steps.parse_prompt.outputs.payload) }} > story.json | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: npm ci | |
- run: npm pkg set type="module" | |
- name: Build file | |
id: build | |
run: npm run action | |
- name: Commit data | |
run: | | |
git config --global user.name 'Story Bot' | |
git config --global user.email 'info@storybot.dev' | |
TITLE=$(jq -r .title story.json) | |
git add ./src/blog | |
git add ./src/img/blog | |
git commit -m "✍️ $TITLE | |
Closes #${{ github.event.issue.number }}" | |
git reset --hard | |
git pull --rebase | |
git push --set-upstream origin main | |
deploy-site: | |
runs-on: ubuntu-latest | |
needs: [generate-story] | |
permissions: | |
actions: write | |
issues: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy workflow | |
run: gh workflow run deploy-site.yml --field post="$URL" --field title="$TITLE" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
URL: ${{ needs.generate-story.outputs.url }} | |
TITLE: ${{ needs.generate-story.outputs.title }} | |
- name: Close Issue | |
run: gh issue close ${{ github.event.issue.number }} -r completed -c "Post released! Check it out in the [blog](https://storybot.dev/blog)!" | |
env: | |
GH_TOKEN: ${{ github.token }} |