Skip to content

Add athena book

Add athena book #5

name: Book Preview Link
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
preview-link:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Add Preview Link
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const previewUrl = `https://www.athenavm.org/book/preview/${context.issue.number}/`;
const commentBody = `📘 Book preview available at: ${previewUrl}`;
// Get all comments
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
// Find our bot comment
const botComment = comments.data.find(comment =>
comment.user.type === 'Bot' && comment.body.includes('Book preview available at:')
);
if (!botComment) {
// Create new comment
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
}