# extract branch name - name: Extract branch name if: github.event_name != 'pull_request' shell: bash run: echo "::set-env name=BRANCH_NAME::$(branchname=${GITHUB_REF#refs/heads/};echo ${branchname,,})" id: extract_branch env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true # extract branch name on pull request - name: Extract branch name on Pull Request if: github.event_name == 'pull_request' run: echo "::set-env name=BRANCH_NAME::$(branchname=${GITHUB_REF};echo ${branchname,,})" env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true # print branch name - name: Get branch name run: echo 'The branch name is' $BRANCH_NAME
ACTIONS_ALLOW_UNSECURE environment variable is added when we get below error.
Reference:
https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
Convert to Uppercase or Lowercase on Linux (linoxide.com)
Get Current Branch Name in GitHub Actions with GITHUB_REF and Bash | Techiediaries
How to Manage GitHub Actions Environment Variables and Secrets (adamtheautomator.com)
Add repo secrets in below location:
https://github.com/org/repo/settings/secrets/actions
No comments:
Post a Comment