AllenInstitute / ecephys_etl_pipelines

Pipelines and modules for processing extracellular electrophysiology data
Other
1 stars 2 forks source link

Fix github-actions CI config #4

Closed njmei closed 3 years ago

njmei commented 3 years ago

This PR is meant to resolve docker images not building after merging a PR into main: https://github.com/AllenInstitute/ecephys_etl_pipelines/runs/2747687614 (example failure)

Previously, the github-actions config was using the GITHUB_HEAD_REF environment variable to determine branch name. Unfortunately, this variable is only set for pull requests causing the associated docker build step to fail for when the "main" branch tries to build a docker image.

The solution is to use bash parameter expansion to both: 1) Default to using GITHUB_HEAD_REF if it exists otherwise use GITHUB_REF 2) Use GITHUB_REF after trimming with parameter expansion since it takes on values like refs/heads/feature-branch-1 and we only want the feature-branch-1 part of the string.

Further reading: https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables https://wiki.bash-hackers.org/syntax/pe