Skip to content

9781784704001 2024-06-01 #219

9781784704001 2024-06-01

9781784704001 2024-06-01 #219

Workflow file for this run

name: Add Post
on:
issues:
types: ['labeled','edited']
jobs:
Checks:
if: contains( github.event.issue.labels.*.name, 'Publish')
runs-on: ubuntu-latest
steps:
- name: Echo
run: echo "Label is $label"
Build:
needs: Checks
runs-on: ubuntu-latest
name: Process Post
steps:
- uses: actions/checkout@v4
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Update title
env:
POST_TITLE: ${{ github.event.issue.title }}
id: title
run: |
POST_FILE=$(echo "$POST_TITLE" | tr " " "-")
echo "::set-output name=file::$(echo "$POST_FILE")"
echo "::set-output name=title::$(echo "$POST_TITLE")"
- name: Generate Post
env:
POST_FILE: "${{ steps.title.outputs.file }}"
POST_TITLE: "${{ steps.title.outputs.title }}"
POST_BODY: "${{ github.event.issue.body }}"
POST_DATE: "${{ steps.date.outputs.date }}"
run: |
cd "_posts"
POST_FM="---\ntitle: ${POST_TITLE}\nlayout: post\ndate: ${POST_DATE}\n\n---\n\r"
file="${POST_DATE}-${POST_FILE}.md"
echo -e "${POST_FM}${POST_BODY}" >> "$file"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
committer: GitHub Action <[email protected]>
branch: "new-config-from-issue=${{ github.event.issue.number }}"
delete-branch: true
title: "publish: ${{ github.event.issue.title}}"
body: |
Automatic PR for publishing: ${{ steps.title.outputs.title }}
Closes #${{ github.event.issue.number }}
reviewers: "${{ github.repository_owner }}"
commit-message: "Post: ${{ github.event.issue.title }}"