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

Commit

Permalink
fix: Do not set PR on closed GitHub PRs (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrockhu authored Jul 20, 2021
1 parent 98fd3d7 commit 828d894
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion SHA1SUM
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
81bcd9a9ae7d3137a17d31fb1633e839c55eeb4c codecov
17da79f2871beb108ac24ba32f19e151200c2dad codecov
8b75c056bddd46e8dbfaa475935fbba6f6a33c77 env
2 changes: 1 addition & 1 deletion SHA256SUM
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
65289785bc738dec8dce952b0fb3bdea1b68453a4db27451d1270b9842ae3cb8 codecov
70ebb9c8fc4ed7af5700eefa254be05dcc1d76f388258e0507914ffe5979d7d3 codecov
8d0fa7c26d1e95f361b054649a1ad6afe5e2a1a0f128289149c7227e15eefc28 env
2 changes: 1 addition & 1 deletion SHA512SUM
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
4e03113a71515f05f1e64626ac61b4814ea76a642640a044a8150b8f764381c92cfcf38b381dbf8aeba340cbf2ed8dc5daf26ff058f348fbf90ad7dea67986ba codecov
75e7ab56a5c60a230bd2b11737578d3dbb9be6b9779722830c22d0a24c08294715dabed8db18975705cd415674d2832813a0e08f7b797fe4ddc88400abb97045 codecov
47689572d9bcf89be411a63129a5eb95257558b5d8df6ae96a973bde6c954e9bc943f6a87c2884440abc831637b967f2da748564ff0f61d99dcf9b0a1447d1df env
7 changes: 5 additions & 2 deletions codecov
Original file line number Diff line number Diff line change
Expand Up @@ -865,8 +865,11 @@ then
if [ "$GITHUB_HEAD_REF" != "" ];
then
# PR refs are in the format: refs/pull/7/merge
pr="${GITHUB_REF#refs/pull/}"
pr="${pr%/merge}"
if [[ "$GITHUB_REF" =~ ^refs\/pull\/[0-9]+\/merge$ ]];
then
pr="${GITHUB_REF#refs/pull/}"
pr="${pr%/merge}"
fi
branch="${GITHUB_HEAD_REF}"
fi
commit="${GITHUB_SHA}"
Expand Down
14 changes: 14 additions & 0 deletions tests/test
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,20 @@ function test_github_action_pr () {
assertURL "https://codecov.io/upload/v4?package=bash-$VERSION&branch=patch-2&commit=$TEST_DATA_GIT_COMMIT&build=32402849&build_url=http%3A%2F%2Fgithub.com%2Fcodecov%2Fci-repo%2Factions%2Fruns%2F32402849&name=&tag=&slug=codecov%2Fci-repo&service=github-actions&flags=&pr=7&job=test&cmd_args=d,C"
}

function test_github_action_closed_pr () {
reset

export GITHUB_ACTIONS="true"
export GITHUB_HEAD_REF="patch-2"
export GITHUB_REF="main"
export GITHUB_REPOSITORY="codecov/ci-repo"
export GITHUB_RUN_ID="32402849"
export GITHUB_SHA="$TEST_DATA_GIT_COMMIT"
export GITHUB_WORKFLOW="test"

assertURL "https://codecov.io/upload/v4?package=bash-$VERSION&branch=patch-2&commit=$TEST_DATA_GIT_COMMIT&build=32402849&build_url=http%3A%2F%2Fgithub.com%2Fcodecov%2Fci-repo%2Factions%2Fruns%2F32402849&name=&tag=&slug=codecov%2Fci-repo&service=github-actions&flags=&pr=&job=test&cmd_args=d,C"
}

function test_github_action_emoji () {
reset

Expand Down

0 comments on commit 828d894

Please sign in to comment.