Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Enhancement: Add support for GitHub actions (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz authored and drazisil committed Oct 23, 2019
1 parent cb4d3a3 commit 98a95cb
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
12 changes: 12 additions & 0 deletions codecov
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,18 @@ then
commit="${CI_BUILD_REF:-$CI_COMMIT_SHA}"
slug="${CI_PROJECT_PATH}"

elif [ "$GITHUB_ACTION" != "" ];
then
say "$e==>$x GitHub Actions detected."

# https://github.com/features/actions
service="github-actions"

# https://help.github.com/en/articles/virtual-environments-for-github-actions#environment-variables
branch="${GITHUB_REF#refs/heads/}"
commit="${GITHUB_SHA}"
slug="${GITHUB_REPOSITORY}"

elif [ "$SYSTEM_TEAMFOUNDATIONSERVERURI" != "" ];
then
say "$e==>$x Azure Pipelines detected."
Expand Down
6 changes: 6 additions & 0 deletions env
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,10 @@ then
add "CI_BUILD_REPO"
add "CI_BUILD_REF"

elif [ "$GITHUB_ACTION" != '' ]
then
add "GITHUB_REF"
add "GITHUB_REPOSITORY"
add "GITHUB_SHA"

fi
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverag


### CI Providers

| Company | Supported | Token Required |
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------- |
| [Travis CI](https://travis-ci.org/) | Yes [![Build Status](https://secure.travis-ci.org/codecov/codecov-bash.svg?branch=master)](http://travis-ci.org/codecov/codecov-bash) | Private only |
Expand All @@ -84,6 +85,7 @@ bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverag
| [Wercker](http://wercker.com/) | Yes | Public & Private |
| [Shippable](http://www.shippable.com/) | Yes | Public & Private |
| [Gitlab CI](https://about.gitlab.com/gitlab-ci/) | Yes | Public & Private |
| [GitHub Actions](https://github.com/features/actions) | Yes | Public & Private |
| git | Yes (as a fallback) | Public & Private |


Expand Down
3 changes: 3 additions & 0 deletions tests/env
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ export ghprbPullId=""
export ghprbSourceBranch=""
export GIT_BRANCH=""
export GIT_COMMIT=""
export GITHUB_REF=""
export GITHUB_REPOSITORY=""
export GITHUB_SHA=""
export GITLAB_CI=""
export JENKINS_URL=""
export MAGNUM=""
Expand Down
10 changes: 10 additions & 0 deletions tests/test
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,16 @@ function test_codeship (){
assertURL "https://codecov.io/upload/v4?package=bash-$VERSION&token=&branch=develop&commit=$TEST_DATA_GIT_COMMIT&build=12.1&build_url=http%3A%2F%2Fendpoint&name=&tag=&slug=codecov%2Fcodecov-bash&service=codeship&flags=&pr=&job="
}

function test_github_action () {
reset

export GITHUB_ACTION="my-fancy-github-action"
export GITHUB_REF="refs/heads/master"
export GITHUB_REPOSITORY="codecov/ci-repo"
export GITHUB_SHA="$TEST_DATA_GIT_COMMIT"

assertURL "https://codecov.io/upload/v4?package=bash-tbd&token=&branch=master&commit=$TEST_DATA_GIT_COMMIT&build=&build_url=&name=&tag=&slug=codecov%2Fci-repo&service=github-actions&flags=&pr=&job="
}

semaphore (){
reset
Expand Down

0 comments on commit 98a95cb

Please sign in to comment.