Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions .github/workflows/publish-scheduled-posts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ on:
default: ""

permissions:
contents: write # required to commit and push the moved post files
contents: write # required to commit changed files to a PR branch
pull-requests: write # required to open the PR

jobs:
publish:
Expand Down Expand Up @@ -57,14 +58,20 @@ jobs:
echo "changed=false" >> "$GITHUB_OUTPUT"
fi

- name: Commit and push published posts
- name: Create Pull Request for published posts
if: steps.publish.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add _posts/ _drafts/
git commit -m "chore: publish scheduled posts for ${{ steps.resolve_date.outputs.date }}"
git push
uses: peter-evans/create-pull-request@v5
with:
token: ${{ github.token }}
branch: published-posts-${{ github.run_id }}
base: master
title: "chore: publish scheduled posts for ${{ steps.resolve_date.outputs.date }}"
commit-message: "chore: publish scheduled posts for ${{ steps.resolve_date.outputs.date }}"
body: |
This automated pull request publishes scheduled drafts for `${{ steps.resolve_date.outputs.date }}`.
add-paths: |
_posts/
_drafts/

- name: Summary
run: |
Expand Down