diff --git a/.github/PULL_REQUEST_TEMPLATE/post.md b/.github/PULL_REQUEST_TEMPLATE/post.md new file mode 100644 index 0000000..e78724f --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/post.md @@ -0,0 +1,11 @@ +--- +title: +layout: post +comments: false +tags: +--- + + diff --git a/.github/workflows/create_post_from_pr.yaml b/.github/workflows/create_post_from_pr.yaml new file mode 100644 index 0000000..c1f105c --- /dev/null +++ b/.github/workflows/create_post_from_pr.yaml @@ -0,0 +1,32 @@ +name: Create Post from PR + +on: + pull_request: + types: [labeled, closed] + +jobs: + create_post: + if: ${{ (github.event.pull_request.merged == true && github.event.label.name == 'post') }} + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Create post file + id: create_post + run: | + PR_TITLE=$(echo "${{ github.event.pull_request.title }}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-') + DATE=$(date +'%Y-%m-%d') + PR_TITLE="${DATE}-${PR_TITLE}" + PR_BODY=${{ github.event.pull_request.body }} + POST_FILE="posts/${PR_TITLE}.md" + echo "${PR_BODY}" >> $POST_FILE + + - name: Commit and push changes + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add posts/ + git commit -m "Create post: ${{ github.event.pull_request.title }}" + git push origin main diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 4230431..d93025d 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -19,7 +19,9 @@ jobs: - id: stack uses: freckle/stack-action@v5 - + with: + stack-build-arguments: --fast # No pedantic for now + - run: stack exec site build - run: |