Skip to content

Calculate perplexity of ISQ models #1632

Calculate perplexity of ISQ models

Calculate perplexity of ISQ models #1632

Workflow file for this run

name: Analysis
on:
pull_request_target
jobs:
comment:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust and Cargo
run: |
curl -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
- name: Install Tokei
run: cargo install tokei
- name: Run Tokei and get the lines of code
run: tokei . > tokei_output.txt
- name: Comment or Update PR
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const tokeiOutput = fs.readFileSync('tokei_output.txt', 'utf8');
const uniqueIdentifier = 'Code Metrics Report';
const codeReport = `
<details>
<summary>${uniqueIdentifier}</summary>
<pre>
${tokeiOutput}
</pre>
</details>
`;
const issue_number = context.issue.number;
const { owner, repo } = context.repo;
const comments = await github.rest.issues.listComments({
issue_number,
owner,
repo
});
const existingComment = comments.data.find(comment => comment.body.includes(uniqueIdentifier));
if (existingComment) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existingComment.id,
body: codeReport
});
} else {
await github.rest.issues.createComment({
issue_number,
owner,
repo,
body: codeReport
});
}