Skip to content

fix: fixing workflow to add main branch as the default branch. #2

fix: fixing workflow to add main branch as the default branch.

fix: fixing workflow to add main branch as the default branch. #2

Workflow file for this run

name: Auto open pull request on puzzle branches
on:
push:
branches:
- 'puzzle/**'
jobs:
open-pull-request:
runs-on: ubuntu-latest
steps:
- name: get issue number
id: get_issue_number
run: |
if [[ ${{ github.ref_name }} =~ puzzle/([0-9]{4})-day-([1-9]|1[0-9]|2[0-5]) ]]; then
year=${BASH_REMATCH[1]}
day=${BASH_REMATCH[2]}
issue_number=$(gh issue list -S '[$year] [Day $day] in:title' --json number | jq '.[].number')
if [ -z "$issue_number" ]; then
echo "::error::Issue not found!"
exit 1
else
echo "issue_number=${issue_number}" >> $GITHUB_OUTPUT
fi
else
echo "::error::Branch does not match the expected pattern"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}
- name: create pull request
run: gh pr create -B main -H ${{ github.ref_name }} --title 'Pull request to resolve #${{ steps.get_issue_number.outputs.issue_number }}'
env:
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}