List Workflow Demo #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Kani List | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ main ] | |
types: [ closed ] | |
permissions: | |
pull-requests: write | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
run-kani-list-on-std: | |
name: List Kani harnesses and contracts on std library | |
runs-on: ${{ matrix.os }} | |
# Only run this job if the pull request was merged | |
if: github.event.pull_request.merged == true | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
include: | |
- os: ubuntu-latest | |
base: ubuntu | |
steps: | |
# Step 1: Check out the repository | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
path: head | |
submodules: true | |
# Step 2: Run list on the std library (assumes it creates kani_list.txt) | |
- name: Run Kani List | |
run: head/scripts/run-kani.sh --run list --path ${{github.workspace}}/head | |
# Step 3: Read kani_list.txt and post comment on PR | |
- name: Comment Results on PR | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const fs = require('fs'); | |
const kaniOutput = fs.readFileSync('${{github.workspace}}/head/kani_list.txt', 'utf8'); | |
await github.rest.issues.createComment({ | |
issue_number: ${{ github.event.pull_request.number }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Kani List Results:\n```\n' + kaniOutput + '\n```' | |
}); |