Skip to content

Commit

Permalink
Update get-release-notes to use github-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikprijck committed Dec 11, 2023
1 parent 0b78278 commit fc2f806
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions .github/actions/get-release-notes/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,18 @@ runs:
using: composite

steps:
- id: get_release_notes
shell: bash
run: |
RELEASE_PR_BRANCH="release/$VERSION"
API_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/pulls"
RELEASE_NOTES=$(curl -G \
-H "Accept: application/json" \
-H "Authorization: token $GITHUB_TOKEN" \
--data-urlencode "state=all" \
--data-urlencode "head=$REPO_OWNER:$RELEASE_PR_BRANCH" \
"$API_URL" | jq -r ".[0].body"
)
{
echo 'RELEASE_NOTES<<EOF'
echo $RELEASE_NOTES
echo 'EOF'
} >> $GITHUB_ENV
- uses: actions/github-script@v7
id: get_release_notes
with:
result-encoding: string
script: |
const { data: pulls } = await github.rest.pulls.list({
owner: process.env.REPO_OWNER,
repo: process.env.REPO_NAME,
state: 'all',
head: `${process.env.REPO_OWNER}:release/${process.env.VERSION}`,
});
core.exportVariable('RELEASE_NOTES', pulls[0].body)
env:
GITHUB_TOKEN: ${{ inputs.token }}
REPO_OWNER: ${{ inputs.repo_owner }}
Expand Down

0 comments on commit fc2f806

Please sign in to comment.