This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Create Pull Request | |
on: | |
push: | |
branches-ignore: | |
- main | |
jobs: | |
create-pull-request: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create Pull Request | |
run: | | |
BRANCH_NAME="${{ github.ref_name }}" | |
if [[ $BRANCH_NAME == *"/"* ]]; then | |
IFS="/" read -ra PARTS <<< "$BRANCH_NAME" | |
PR_TITLE="${PARTS[0]}: ${PARTS[1]^}" | |
PR_TITLE="${PR_TITLE//-/ }" | |
else | |
PR_TITLE="${BRANCH_NAME//-/ }" | |
fi | |
gh pr create \ | |
-B main \ | |
-H "$BRANCH_NAME" \ | |
--title "$PR_TITLE" \ | |
--body "" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |