Skip to content

feat: agentic-seo benchmark #4

feat: agentic-seo benchmark

feat: agentic-seo benchmark #4

Workflow file for this run

name: Agentic SEO Check
on:
pull_request:
branches:
- main
jobs:
analyze:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run Agentic SEO
id: seo-check
run: npx agentic-seo --json > agentic-seo-results.json || true
- name: Comment PR with results
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
// 1. Read and parse the JSON output
let results;
try {
const fileContent = fs.readFileSync('./agentic-seo-results.json', 'utf8');
results = JSON.parse(fileContent);
} catch (err) {
console.log("Could not read JSON output.", err);
return;
}
const { score, grade, summary } = results;
// 2. Format the comment
const body = `### 🤖 Agentic SEO Check
**Score:** ${score}/100
**Grade:** ${grade}
**Summary:**
* 🔴 **Errors:** ${summary.errors}
* 🟠 **Warnings:** ${summary.warnings}
* 🟢 **Passed:** ${summary.passed}
_Run \`npx agentic-seo\` locally to see the full breakdown and fixes._`;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.reverse().find(c =>
c.user.type === 'Bot' && c.body.includes('### 🤖 Agentic SEO Check')
);
if (botComment) {
console.log('Updating existing comment...');
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: body
});
} else {
console.log('Creating new comment...');
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})
}