Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/transferwise/sanitize-branch-name
A Github action that determines the branch name, then sanitizes it of any forward slashes
https://github.com/transferwise/sanitize-branch-name
Last synced: about 1 month ago
JSON representation
A Github action that determines the branch name, then sanitizes it of any forward slashes
- Host: GitHub
- URL: https://github.com/transferwise/sanitize-branch-name
- Owner: transferwise
- License: other
- Created: 2021-09-06T12:09:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-02T13:52:02.000Z (about 2 years ago)
- Last Synced: 2024-11-06T17:35:35.771Z (3 months ago)
- Homepage:
- Size: 4.88 KB
- Stars: 2
- Watchers: 52
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# Santize Branch Name
A Github action that determines the branch name, then sanitizes it of any forward slashes.
## Description
Determination of the branch name is important when an action can run on both a PR and post-merge master/main. As the github context doesn't fully support providing the branch name directly via a single reference.
Sanitizing the branch name of forward slashes helps ensure any subsequent actions that want the branch name, such as an artifact name, don't break due to the special character. Forward slashes break inside of actions/artifact-upload@v1, but are supported by git as a valid branch name.
Takes no input, and provides two outputs. The actual branch name, and the sanitized version.
## Usage
```yml
jobs:foo:
name: "foo - do some things"steps:
- name: "Determine Branch"
id: branches
uses: transferwise/sanitize-branch-name@v1- name: "Echo branch name"
shell: bash
run: 'echo "branch name is: ${{ steps.branches.outputs.branch-name }}"'- name: "Echo sanitized branch name"
shell: bash
run: 'echo "branch name is: ${{ steps.branches.outputs.sanitized-branch-name }}"'```