Skip to content

Add verify message for new subscribers #938

Add verify message for new subscribers

Add verify message for new subscribers #938

Workflow file for this run

name: Checks
on:
pull_request:
types: [opened, synchronize, reopened]
issue_comment:
types: [created]
permissions:
pull-requests: read
jobs:
linear-history:
# Run on PR events, or on /allow-merges comment on a PR
if: >
github.event_name == 'pull_request' ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '/allow-merges'))
runs-on: ubuntu-latest
steps:
- name: Check for override comment
id: override
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const hasOverride = comments.data.some(c =>
c.body.includes('/allow-merges')
);
core.setOutput('skip', hasOverride ? 'true' : 'false');
if (hasOverride) {
console.log('Found /allow-merges comment - skipping linear history check');
}
# On issue_comment events, we skip straight to success
- name: Skip (override via comment)
if: >
github.event_name == 'issue_comment' ||
steps.override.outputs.skip == 'true'
run: echo "✅ Linear history check overridden via /allow-merges comment"
- name: Checkout
if: github.event_name == 'pull_request' && steps.override.outputs.skip != 'true'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Check for linear history
if: github.event_name == 'pull_request' && steps.override.outputs.skip != 'true'
run: |
git fetch origin main
MERGE_BASE=$(git merge-base origin/main HEAD)
MERGE_COMMITS=$(git log --merges --oneline "$MERGE_BASE"..HEAD)
if [ -n "$MERGE_COMMITS" ]; then
echo "::error::Branch contains merge commits. Please rebase instead of merging."
echo ""
echo "Merge commits found:"
echo "$MERGE_COMMITS"
echo ""
echo "To fix: git rebase origin/main"
echo "To override: comment '/allow-merges' on this PR"
exit 1
fi
echo "✅ Branch has linear history (no merge commits)"