|
| 1 | +name: Benchmark Instructions |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request_target: |
| 5 | + types: [opened] |
| 6 | + |
| 7 | +permissions: |
| 8 | + issues: write |
| 9 | + pull-requests: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + post-instructions: |
| 13 | + name: Post benchmark instructions |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Comment benchmark usage |
| 17 | + uses: actions/github-script@v7 |
| 18 | + with: |
| 19 | + github-token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }} |
| 20 | + script: | |
| 21 | + const body = [ |
| 22 | + "## Benchmark This PR", |
| 23 | + "", |
| 24 | + "Run benchmarks by commenting on this PR:", |
| 25 | + "", |
| 26 | + "```", |
| 27 | + "/benchmark [benchmark.sh args...]", |
| 28 | + "/benchmark [scenario-limit|all] --concurrency <n> --effort <n> --max-iterations <n>", |
| 29 | + "```", |
| 30 | + "", |
| 31 | + "Everything after `/benchmark` is forwarded directly to `./benchmark.sh`.", |
| 32 | + "", |
| 33 | + "Examples:", |
| 34 | + "- `/benchmark` -> run default DRC14 benchmark settings", |
| 35 | + "- `/benchmark 10` -> run first 10 DRC14 samples", |
| 36 | + "- `/benchmark all --concurrency 4` -> run all DRC14 samples with 4 workers", |
| 37 | + "- `/benchmark --scenario-limit all --effort 2` -> run all samples with effort 2", |
| 38 | + "- `/benchmark --scenario-limit 20 --max-iterations 100` -> run 20 samples with a max iteration override", |
| 39 | + "", |
| 40 | + "Any PR whose title contains `[BENCHMARK TEST]` will automatically run the benchmark workflow on PR updates.", |
| 41 | + ].join("\n") |
| 42 | +
|
| 43 | + await github.rest.issues.createComment({ |
| 44 | + owner: context.repo.owner, |
| 45 | + repo: context.repo.repo, |
| 46 | + issue_number: context.payload.pull_request.number, |
| 47 | + body, |
| 48 | + }) |
0 commit comments