Merge branch 'main' into puzzle/2015-day-1 #1
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 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 ${{ GITHUB_DEFAULT_BRANCH }} -H ${{ github.ref_name }} --title 'Pull request to resolve #${{ steps.get_issue_number.outputs.issue_number }}' | ||
Check failure on line 34 in .github/workflows/auto-pr.yml GitHub Actions / Auto open pull request on puzzle branchesInvalid workflow file
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} |