Skip to content

fix(skills): use closed candles and preserve prediction discovery #22

fix(skills): use closed candles and preserve prediction discovery

fix(skills): use closed candles and preserve prediction discovery #22

Workflow file for this run

name: Docs checks
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "docs/**"
- "tools/docs/**"
- "plugins/ask-gina/skills/**"
- "plugins/ask-gina/.mcp.json"
- "packages/contracts/src/index.ts"
- ".github/workflows/docs.yml"
push:
branches:
- main
paths:
- "docs/**"
- "tools/docs/**"
- "plugins/ask-gina/skills/**"
- "plugins/ask-gina/.mcp.json"
- "packages/contracts/src/index.ts"
- ".github/workflows/docs.yml"
workflow_dispatch:
concurrency:
group: docs-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: "24.7.0"
- name: Test docs checks
run: node --test tools/docs/check.test.mjs
- name: Validate docs, assets, access, and corpus compatibility
run: node tools/docs/check.mjs --external
preview-comment:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
persist-credentials: false
- name: Post docs preview summary
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('node:fs');
if (!context.payload.pull_request) {
core.info('No pull request context; skipping.');
return;
}
const marker = '<!-- docs-preview-comment -->';
const { owner, repo } = context.repo;
const issue_number = context.payload.pull_request.number;
const files = await github.paginate(github.rest.pulls.listFiles, {
owner,
repo,
pull_number: issue_number,
per_page: 100
});
const changedPaths = files.map((file) => file.filename);
const changedDocsPages = [...new Set(
changedPaths
.filter((file) => /^docs\/.*\.(md|mdx)$/.test(file))
.map((file) => file.replace(/^docs\//, '').replace(/\.(md|mdx)$/, ''))
)];
const collectPagesFromEntries = (entries) => {
const pages = [];
for (const entry of entries ?? []) {
if (typeof entry === 'string' && entry.length > 0) {
pages.push(entry);
continue;
}
if (entry && typeof entry === 'object' && Array.isArray(entry.pages)) {
pages.push(...collectPagesFromEntries(entry.pages));
}
}
return pages;
};
let navGroups = [];
if (fs.existsSync('docs/mint.json')) {
const mint = JSON.parse(fs.readFileSync('docs/mint.json', 'utf8'));
navGroups = (mint.navigation ?? [])
.filter((group) =>
collectPagesFromEntries(group.pages).some((page) =>
changedDocsPages.includes(page)
)
)
.map((group) => group.group);
}
const mintChanged = changedPaths.includes('docs/mint.json');
const bodyLines = [
marker,
'### Docs Preview',
'',
`Changed docs pages: **${changedDocsPages.length}**`,
];
if (changedDocsPages.length > 0) {
bodyLines.push('', ...changedDocsPages.map((page) => `- \`${page}\``));
}
bodyLines.push('', `Navigation updated: **${mintChanged ? 'yes' : 'no'}**`);
if (navGroups.length > 0) {
bodyLines.push('', 'Impacted nav groups:', '', ...navGroups.map((group) => `- ${group}`));
}
const body = bodyLines.join('\n');
const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number,
per_page: 100
});
const existing = comments.find((comment) => comment.body?.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existing.id,
body
});
} else {
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body
});
}