CI: Get the repository and branch name being built

Is there a way to find the repository and branch name being built in my Github Actions CI? If you are familiar with travis, I am looking for the alternative to travis’ TRAVIS_REPO_SLUG environment variable.

1 Like

Hello, @reikdas!  Please consider this document from the official GitHub Actions documenation:

Using environment variables

It lists all the environment variables that are automatically created in the Workflow environment.

Among the variables are:

GITHUB_REPOSITORY The owner and repository name. For example, octocat/Hello-World.


GITHUB_REF The branch or tag ref that triggered the workflow. For example, refs/heads/feature-branch-1. If neither a branch or tag is available for the event type, the variable will not exist.

Those should cover the cases you need.

Please update the discussion to let readers know how you fared with this information.