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 []
http method github POST /api/v3/repos/cloudflare/pint/pulls/1/comments 200 {}
http start github 127.0.0.1:6118

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

mkdir my/dir/rules
cp ../src/rules.yml my/dir/rules/rules.yml
exec ln -s my/dir/rules v1dir
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
exec git mv v1dir v2dir
exec git commit -am 'v2'

env GITHUB_AUTH_TOKEN=12345
env GITHUB_PULL_REQUEST_NUMBER=1
exec pint -l debug --no-color ci
! stdout .
stderr 'level=INFO msg="Pull request review created" status="200 OK"'
stderr 'msg="Skipping directory entry change"'
cmp github.got ../github.expected

-- src/rules.yml --
groups:
- name: foo
  rules:
  - alert: rule1
    expr: rate(errors_total[5m]) > 0
  - alert: rule2
    expr: rate(errors_total[5m]) > 0

-- src/.pint.hcl --
ci {
  baseBranch = "main"
}
repository {
  github {
    baseuri   = "http://127.0.0.1:6118"
    uploaduri = "http://127.0.0.1:6118"
    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

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 | 2 |
  | Number of rules checked | 2 |
  | Number of problems found | 0 |
  | Number of offline checks | 0 |
  | Number of online checks | 0 |
  | Checks duration | 0 |

  </p>
  </details>

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

  No problems reported
  </p>
  </details>

event: COMMENT
--- END ---

