Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add base_branch to exported envs #34

Closed
iamogbz opened this issue Apr 27, 2020 · 5 comments · Fixed by #36
Closed

Add base_branch to exported envs #34

iamogbz opened this issue Apr 27, 2020 · 5 comments · Fixed by #36

Comments

@iamogbz
Copy link
Contributor

iamogbz commented Apr 27, 2020

Currently it does not look like there's a way to get the base branch being targeted in the case of a pull request.

@siddharthkp
Copy link
Owner

Which CI platform are you on?

Does this bit help?: https://github.com/siddharthkp/ci-env/blob/master/index.js#L19-L22

@iamogbz
Copy link
Contributor Author

iamogbz commented Apr 27, 2020

@siddharthkp want to use it for a tool that could be run on any env. Looks like the code will only tell you current branch.

ci-env/index.js

Lines 19 to 22 in cc891b5

branch =
process.env.TRAVIS_EVENT_TYPE === 'push'
? process.env.TRAVIS_BRANCH
: process.env.TRAVIS_PULL_REQUEST_BRANCH

When running from a pull request e.g.
Screen Shot 2020-04-27 at 2 09 55 PM
It would tell you develop, but I want to also know which branch is being targeted i.e. master

@siddharthkp
Copy link
Owner

ah, I understand now. Does travis/other CI expose that information?

@iamogbz
Copy link
Contributor Author

iamogbz commented Apr 28, 2020

@siddharthkp travis has TRAVIS_BRANCH https://docs.travis-ci.com/user/environment-variables/, I think github has GITHUB_BASE_REF. Not certain about others, but hopefully they would

@siddharthkp
Copy link
Owner

siddharthkp commented May 5, 2020

Perfect, would you like to shot on the implementation? It might make sense to keep the name similar to pull_request_number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants