fix: fixing error on the use of "#", it was being interpreted as an Y… #11
This file contains hidden or 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 open pull request on puzzle branches | |
| on: | |
| push: | |
| branches: | |
| - 'puzzle/**' | |
| jobs: | |
| open-pull-request: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - 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 }} -t "Pull request to resolve #${{ steps.get_issue_number.outputs.issue_number }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} |