http method github GET /api/v3/repos/cloudflare/pint/pulls/1/reviews 200 []
http method github POST /api/v3/repos/cloudflare/pint/pulls/1/reviews 200 {}
http method github GET /api/v3/repos/cloudflare/pint/pulls/1/comments 200 []
http method github GET /api/v3/repos/cloudflare/pint/issues/1/comments 200 [{"id":999,"body":"stale general comment from previous pint run"}]
http method github POST /api/v3/repos/cloudflare/pint/pulls/1/comments 200 {}
http method github DELETE /api/v3/repos/cloudflare/pint/issues/comments/999 200 {}
http start github 127.0.0.1:6271

mkdir testrepo
cd testrepo
exec git init --initial-branch=main .

cp ../src/v1.yml rules.yml
cp ../src/.pint.hcl .
env GIT_AUTHOR_NAME=pint
env GIT_AUTHOR_EMAIL=pint@example.com
env GIT_COMMITTER_NAME=pint
env GIT_COMMITTER_EMAIL=pint@example.com
exec git add .
exec git commit -am 'import rules and config'

exec git checkout -b v2
cp ../src/v2.yml rules.yml
exec git commit -am 'v2'

env GITHUB_AUTH_TOKEN=12345
env GITHUB_PULL_REQUEST_NUMBER=1
exec pint -l debug --offline --no-color ci
! stdout .
stderr 'level=INFO msg="Deleting stale general comment" reporter=GitHub id=999'
stderr 'level=INFO msg="Pull request review created" status="200 OK"'
cmp github.got ../github.expected

-- src/v1.yml --
- record: foo
  expr: sum(up)
  labels:
    cluster: dev

-- src/v2.yml --
- record: foo
  expr: sum(up)
  labels:
    cluster: prod

-- src/.pint.hcl --
ci {
  baseBranch = "main"
}
parser {
  relaxed = [".*"]
}
repository {
  github {
    baseuri   = "http://127.0.0.1:6271"
    uploaduri = "http://127.0.0.1:6271"
    owner     = "cloudflare"
    repo      = "pint"
  }
}

-- github.expected --
GET /api/v3/repos/cloudflare/pint/pulls/1/comments
  Accept: application/vnd.github.squirrel-girl-preview, application/vnd.github.comfort-fade-preview+json
  Accept-Encoding: gzip
  Authorization: Bearer 12345
  X-Github-Api-Version: 2022-11-28

GET /api/v3/repos/cloudflare/pint/issues/1/comments
  Accept: application/vnd.github.squirrel-girl-preview
  Accept-Encoding: gzip
  Authorization: Bearer 12345
  X-Github-Api-Version: 2022-11-28

DELETE /api/v3/repos/cloudflare/pint/issues/comments/999
  Accept: application/vnd.github.v3+json
  Accept-Encoding: gzip
  Authorization: Bearer 12345
  X-Github-Api-Version: 2022-11-28

GET /api/v3/repos/cloudflare/pint/pulls/1/reviews
  Accept: application/vnd.github.v3+json
  Accept-Encoding: gzip
  Authorization: Bearer 12345
  X-Github-Api-Version: 2022-11-28

POST /api/v3/repos/cloudflare/pint/pulls/1/reviews
  Accept: application/vnd.github.v3+json
  Accept-Encoding: gzip
  Authorization: Bearer 12345
  Content-Type: application/json
  X-Github-Api-Version: 2022-11-28
--- BODY ---
commit_id: <COMMIT ID>
body: |+
    ### This pull request was validated by [pint](https://github.com/cloudflare/pint).
    :heavy_check_mark: No problems found
    <details><summary>Stats</summary>
    <p>

    | Stat | Value |
    | --- | --- |
    | Version | unknown |
    | Number of rules parsed | 1 |
    | Number of rules checked | 1 |
    | Number of problems found | 0 |
    | Number of offline checks | 10 |
    | Number of online checks | 0 |
    | Checks duration | 0 |

    </p>
    </details>

    <details><summary>Problems</summary>
    <p>

    No problems reported
    </p>
    </details>

event: COMMENT
--- END ---

