βοΈ "Forging a New Path: The Evolution of Pathfinder 2e" #143
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: "Issue Generator" | |
| on: | |
| issues: | |
| types: [labeled] | |
| jobs: | |
| parse-issue: | |
| runs-on: ubuntu-latest | |
| if: github.event.label.name == 'generate-story' | |
| permissions: | |
| issues: read | |
| contents: write | |
| pull-requests: 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 Prompt to file | |
| run: echo "$PROMPT" > prompt.txt | |
| env: | |
| PROMPT: ${{ fromJson(steps.parse_prompt.outputs.payload).Prompt }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - run: npm ci | |
| - run: npm pkg set type="module" | |
| - name: Write story | |
| id: write | |
| run: npm run prompt | |
| env: | |
| USER_NAME: ${{ github.event.issue.user.login }} | |
| USER_AVATAR: ${{ github.event.issue.user.avatar_url }} | |
| OPEN_AI_KEY: ${{ secrets.OPEN_AI_KEY }} | |
| - name: Commit the story | |
| run: | | |
| git config --global user.name 'Story Bot' | |
| git config --global user.email 'info@storybot.dev' | |
| git checkout -b prompt/issue-${{ github.event.issue.number }} | |
| git add ./src/blog | |
| git add ./src/img/blog | |
| git commit -m "βοΈ ${{ steps.write.outputs.title }} | |
| Co-authored-by: $USERNAME <$USERNAME@users.noreply.github.com>" | |
| git push --set-upstream origin prompt/issue-${{ github.event.issue.number }} | |
| env: | |
| USERNAME: ${{ github.event.issue.user.login }} | |
| - name: Create Body file | |
| run: | | |
| echo "This PR closes #${{ github.event.issue.number }}" >> body.txt | |
| echo "## Prompt" >> body.txt | |
| echo "${{ fromJson(steps.parse_prompt.outputs.payload).Prompt }}" >> body.txt | |
| - name: Create PR | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh pr create --title "βοΈ ${{ steps.write.outputs.title }}" --body-file body.txt |