Skip to content

chore: create draft item for post PRs #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion .github/workflows/create_new_post_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ jobs:
branch_name=$(echo "${{ github.event.inputs.name }}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
echo "Branch name: ${branch_name}"
git checkout -b "$branch_name"
git commit --allow-empty -m "create PR from branch ${branch_name}"

# Create the draft item
touch drafts/${branch_name}
git add drafts
git commit -m "create PR from branch ${branch_name}"

git push origin "$branch_name"
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT

Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/generate_post_from_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ jobs:
id: create_post
run: |
PR_TITLE=${{ github.event.pull_request.title }}
PR_TITLE=${PR_TITLE#post/}
DRAFT_TITLE=${PR_TITLE#post/}

# Remove the draft item
git rm drafts/${DRAFT_TITLE}

DATE=$(date +'%Y-%m-%d')
PR_TITLE="${DATE}-${PR_TITLE}"
POST_TITLE="${DATE}-${DRAFT_TITLE}"
PR_BODY=${{ github.event.pull_request.body }}
POST_FILE="posts/${PR_TITLE}.md"
POST_FILE="posts/${POST_TITLE}.md"
echo "${PR_BODY}" >> $POST_FILE

- name: Commit and push changes
Expand Down