Skip to content

Add cuTile base image #2

Add cuTile base image

Add cuTile base image #2

name: PR Signature Comment
on:
pull_request_target:
types: [opened, reopened, synchronize]
jobs:
check-and-comment:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Check for unsigned commits and comment
uses: actions/github-script@v7
with:
script: |
// Get all commits in this PR
const commits = await github.rest.pulls.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
// Check for unsigned commits
const unsignedCommits = commits.data.filter(commit =>
!commit.commit.verification || !commit.commit.verification.verified
);
if (unsignedCommits.length === 0) {
console.log('All commits are signed. No comment needed.');
return;
}
console.log(`Found ${unsignedCommits.length} unsigned commit(s).`);
// Check if we already left a comment about signatures
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
const signatureCommentMarker = '<!-- signature-reminder-comment -->';
const existingComment = comments.data.find(comment =>
comment.body.includes(signatureCommentMarker)
);
const unsignedList = unsignedCommits.map(c =>
`- \`${c.sha.substring(0, 7)}\` ${c.commit.message.split('\n')[0]}`
).join('\n');
const commentBody = `${signatureCommentMarker}
⚠️ **Unsigned Commits Detected**
This pull request contains ${unsignedCommits.length} unsigned commit(s):
${unsignedList}
All commits must be signed before this PR can be merged. Please sign your commits by following these steps:
### Option 1: SSH Key Signing (Recommended)
1. **Add your SSH key to GitHub** (if not already done):
- Go to [GitHub SSH Keys Settings](https://github.com/settings/keys)
- Click "New SSH Key" and select "Signing Key" as the key type
2. **Configure Git to use SSH signing**:
\`\`\`bash
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub # or your key path
git config --global commit.gpgsign true
\`\`\`
3. **Re-sign your commits**:
\`\`\`bash
git rebase -i HEAD~${unsignedCommits.length} --exec "git commit --amend --no-edit -S"
git push --force
\`\`\`
### Option 2: GPG Key Signing
1. **Generate a GPG key**: [GitHub Docs](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key)
2. **Add the GPG key to GitHub**: [GitHub Docs](https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account)
3. **Configure Git to sign commits**:
\`\`\`bash
git config --global user.signingkey YOUR_GPG_KEY_ID
git config --global commit.gpgsign true
\`\`\`
4. **Re-sign your commits** (same as above):
\`\`\`bash
git rebase -i HEAD~${unsignedCommits.length} --exec "git commit --amend --no-edit -S"
git push --force
\`\`\`
For more details, see [GitHub's commit signature verification docs](https://docs.github.com/en/authentication/managing-commit-signature-verification).
---
*This comment will be updated when you push new commits.*`;
if (existingComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body: commentBody
});
console.log('Updated existing signature reminder comment.');
} else {
// Create new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: commentBody
});
console.log('Created new signature reminder comment.');
}