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
15 changes: 5 additions & 10 deletions .github/workflows/create_new_post_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,25 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Create new branch
id: create_branch
- name: Make draft item and get branch name
id: get_name
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
branch_name=$(echo "${{ github.event.inputs.name }}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
echo "Branch name: ${branch_name}"
git checkout -b "$branch_name"

# Create the draft item
# Create an item in drafts directory
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

- name: Create Pull Request
id: create_pr
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.create_branch.outputs.branch_name }}
branch: ${{ steps.get_name.outputs.branch_name }}
base: main
title: posts/${{ steps.create_branch.outputs.branch_name }}
title: posts/${{ steps.get_name.outputs.branch_name }}
body-path: '${{ github.workspace }}/.github/PULL_REQUEST_TEMPLATE/post.md'
labels: 'post'