Release process update #5
Workflow file for this run
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: PR Base Branch Check | |
on: | |
pull_request: | |
types: [opened, edited, synchronize] | |
branches: | |
- main | |
permissions: | |
pull-requests: write | |
contents: read | |
jobs: | |
check-base-branch: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.base.ref == 'main' | |
steps: | |
- name: Comment on PR | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const message = `👋 Hi there! | |
It looks like this PR is targeting the \`main\` branch. To help maintain our development workflow, please change the base reference to \`next\` instead. | |
__If this is a bug fix that requires a patch release __ (e.g., a critical bug that needs to be fixed before the next release)__, please leave the base branch as \`main\`.__ | |
You can change this by: | |
1. Clicking the "Edit" button next to the PR title | |
2. Changing the base branch from \`main\` to \`next\` | |
3. Clicking "Update pull request" | |
Thanks for your contribution! 🚀`; | |
// Check if we've already commented | |
const comments = await github.rest.issues.listComments({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
}); | |
const botComment = comments.data.find(comment => | |
comment.user.type === 'Bot' && | |
comment.body.includes('please change the base reference to') | |
); | |
if (!botComment) { | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body: message | |
}); | |
} |