Automated bump pr approve (#148) #2
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: Make Pre-Release | ||
Check failure on line 1 in .github/workflows/make-prerelease.yml
|
||
on: | ||
workflow_dispatch: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
jobs: | ||
bump_version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create Pull Request | ||
id: create-pr | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const { owner, repo } = context.repo; | ||
const pr = await github.rest.pulls.create({ | ||
owner, | ||
repo, | ||
title: `Creating Release: ${require('./package.json').version}`, | ||
head: 'develop', | ||
base: 'pre-release', | ||
}); | ||
core.setOutput('pr_number', pr.data.number); | ||
- name: Approve Pull Request | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.PAT_GITHUB } | ||
script: | | ||
const prNumber = process.env.PR_NUMBER; | ||
if (!prNumber) { | ||
console.log("No PR number found. Skipping approval."); | ||
return; | ||
} | ||
await github.rest.pulls.createReview({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: prNumber, | ||
event: 'APPROVE', | ||
body: 'This PR was automatically approved by the workflow.' | ||
}); | ||
env: | ||
PR_NUMBER: ${{ steps.create-pr.outputs.pr_number }} |