www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

github-service.rkt (747B)


      1 #lang racket/base
      2 (provide github-service@ github-ci?)
      3 
      4 (require "ci-service.rkt" racket/unit racket/list racket/string)
      5 
      6 (define (github-ci?) (and (getenv "GITHUB_REPOSITORY") (getenv "CODECOV_TOKEN")))
      7 
      8 (define-unit github-service@
      9   (import)
     10   (export ci-service^)
     11 
     12   (define (query)
     13     (define repo-slug (getenv "GITHUB_REPOSITORY"))
     14     (list (cons 'service "custom")
     15           (cons 'token (getenv "CODECOV_TOKEN"))
     16           ;; TODO: this won't work for tags
     17           (cons 'branch (string-trim (getenv "GITHUB_REF") #px"refs/(heads|tags)/"))
     18           (cons 'job (getenv "GITHUB_JOB"))
     19           (cons 'slug (getenv "GITHUB_REPOSITORY"))
     20           (cons 'build (getenv "GITHUB_RUN_ID"))
     21           (cons 'commit (getenv "GITHUB_SHA")))))