Skip to content

feat: make repository titles clickable links to GitHub (closes #60) #34

feat: make repository titles clickable links to GitHub (closes #60)

feat: make repository titles clickable links to GitHub (closes #60) #34

name: pr_review_notice
on:
pull_request_target:
types: [opened, reopened]
permissions:
contents: read
issues: write
pull-requests: write
jobs:
comment_review_notice:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
# Use the built-in token so the comment is authored by github-actions[bot]
github-token: ${{ github.token }}
script: |
const { owner, repo } = context.repo;
const pr = context.payload.pull_request;
const pr_number = pr.number;
const pr_author = pr.user.login;
const maintainers = ["o2sa"].map(u => u.toLowerCase());
if (maintainers.includes(pr_author.toLowerCase())) return;
const body =
"Thank you for the pull request! ✅\n\n" +
"A maintainer will review this soon. Please be patient while we take a look. 🙌";
// Avoid duplicate comment spam
const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number: pr_number,
per_page: 100,
});
const already = comments.some(c =>
(c.body || "").includes("Thank you for the pull request! ✅")
);
if (already) return;
// Create comment
await github.rest.issues.createComment({
owner,
repo,
issue_number: pr_number,
body,
});
// React to the PR with 👀
try {
await github.rest.reactions.createForIssue({
owner,
repo,
issue_number: pr_number,
content: "eyes",
});
} catch (e) {
// Don't fail the workflow if reactions aren't permitted
core.info(`Could not add reaction: ${e.message}`);
}