Skip to content

feat: major v0.2.0 release with default template and install command #1

feat: major v0.2.0 release with default template and install command

feat: major v0.2.0 release with default template and install command #1

name: PR Rebase Reminder
on:
pull_request:
types: [opened, synchronize]
jobs:
check-rebase-needed:
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if rebase is needed
id: rebase_check
run: |
git fetch origin main
BEHIND_COUNT=$(git rev-list --count HEAD..origin/main)
echo "behind_count=$BEHIND_COUNT" >> $GITHUB_OUTPUT
- name: Comment on PR if rebase needed
if: steps.rebase_check.outputs.behind_count > 0
uses: actions/github-script@v7
with:
script: |
const behindCount = '${{ steps.rebase_check.outputs.behind_count }}';
if (behindCount > 0) {
const body = `## 🔄 Rebase Required
This branch is ${behindCount} commit(s) behind the main branch. Please rebase your branch to ensure a clean merge:
\`\`\`bash
git fetch origin main
git rebase origin/main
git push --force-with-lease
\`\`\`
This is required by our branch protection rules to maintain a linear git history.`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});
}