Skip to content

Commit

Permalink
Merge pull request #115 from paambaati/pr-branch-fix
Browse files Browse the repository at this point in the history
Report the correct Git branch name for PRs - fixes #86
  • Loading branch information
paambaati authored Feb 26, 2020
2 parents 7a1a45f + 87a66a5 commit 8f42562
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


# [2.5.1] - 2020-02-26
### Fixed
- Fix reporting the [wrong branch name for PRs](https://github.com/paambaati/codeclimate-action/issues/86) - via [`#115`](https://github.com/paambaati/codeclimate-action/pull/115).

# [2.5.0] - 2020-02-25
### Added
- Custom `--prefix` support - via [`#111`](https://github.com/paambaati/codeclimate-action/pull/111).
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This action requires that you set the [`CC_TEST_REPORTER_ID`](https://docs.codec
```yaml
steps:
- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v2.5.0
uses: paambaati/codeclimate-action@v2.5.1
env:
CC_TEST_REPORTER_ID: <code_climate_reporter_id>
with:
Expand All @@ -36,7 +36,7 @@ steps:
```yaml
steps:
- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v2.5.0
uses: paambaati/codeclimate-action@v2.5.1
env:
# Set CC_TEST_REPORTER_ID as secret of your repo
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codeclimate-action",
"version": "2.5.0",
"version": "2.5.1",
"private": true,
"description": "Publish code coverage to Code Climate",
"main": "lib/main.js",
Expand Down
5 changes: 5 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ function prepareEnv() {

if (env.GIT_BRANCH)
env.GIT_BRANCH = env.GIT_BRANCH.replace(/^refs\/heads\//, ''); // Remove 'refs/heads/' prefix (See https://github.com/paambaati/codeclimate-action/issues/42)

if (process.env.GITHUB_EVENT_NAME === 'pull_request') {
env.GIT_BRANCH = process.env.GITHUB_HEAD_REF || env.GIT_BRANCH; // Report correct branch for PRs (See https://github.com/paambaati/codeclimate-action/issues/86)
}

return env;
}

Expand Down

0 comments on commit 8f42562

Please sign in to comment.