Skip to content

Commit

Permalink
build: get PR number
Browse files Browse the repository at this point in the history
  • Loading branch information
huaichaow committed Jun 29, 2023
1 parent 5d65adc commit ad81bdd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 39 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/create-pr.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,24 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release

# reference:
# * https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#create-a-pull-request
# * https://docs.github.com/en/rest/guides/getting-started-with-the-rest-api?apiVersion=2022-11-28#authentication-example-for-github-actions
#
# grant PR permission to GitHub Actions: `Allow GitHub Actions to create and approve pull requests`
# * https://github.com/huaichaow/marked-toc-extension/settings/actions
- name: Create PR to main branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pr_number=$(gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/huaichaow/marked-toc-extension/pulls \
-f title='Amazing new feature' \
-f body='Please pull these awesome changes in!' \
-f head='release/main' \
-f base='main' | jq '.number')
echo ${pr_number}

0 comments on commit ad81bdd

Please sign in to comment.