{"id":28069802,"url":"https://github.com/keptn/gh-action-extract-branch-name","last_synced_at":"2025-05-12T19:15:12.181Z","repository":{"id":65155565,"uuid":"329324324","full_name":"keptn/gh-action-extract-branch-name","owner":"keptn","description":"GH Action to extract branch name for commits and PRs","archived":false,"fork":false,"pushed_at":"2022-10-18T07:32:11.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-12T19:15:01.742Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keptn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-13T13:57:05.000Z","updated_at":"2022-10-18T07:32:14.000Z","dependencies_parsed_at":"2023-01-05T13:20:08.788Z","dependency_job_id":null,"html_url":"https://github.com/keptn/gh-action-extract-branch-name","commit_stats":{"total_commits":2,"total_committers":2,"mean_commits":1.0,"dds":0.5,"last_synced_commit":"6ca4fe061da10c66b2d7341fd1fb12962ad911b2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keptn%2Fgh-action-extract-branch-name","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keptn%2Fgh-action-extract-branch-name/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keptn%2Fgh-action-extract-branch-name/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keptn%2Fgh-action-extract-branch-name/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keptn","download_url":"https://codeload.github.com/keptn/gh-action-extract-branch-name/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253805845,"owners_count":21967054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-12T19:15:11.575Z","updated_at":"2025-05-12T19:15:12.174Z","avatar_url":"https://github.com/keptn.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GH Action to Extract Branch Name for commits and PRs\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/keptn/gh-action-extract-branch-name)\n\nThis repo provides a utility GitHub action for the [CI Workflow](https://github.com/keptn/keptn/tree/master/.github/workflows) in the [Keptn Project](https://github.com/keptn). Nevertheless, this action provides a very basic functionality, as in \"Extract the current branch name or Pull Request ID\", which is useful for creating artifacts based on the branch name (e.g., `docker build . -t my-image:$BRANCH_NAME`).\nIn addition, as a convenience, it provides the `GIT_SHA` of the commit (if executed on a local branch) or the merge commit (if executed on aPull Request).\n\n*Note*: This requires the full git repo to be cloned, so use `fetch-depth: 0`\n```\n      - name: Check out code\n        uses: actions/checkout@v2\n        with:\n          fetch-depth: 0 # need to checkout \"all commits\" for certain features to work (e.g., get all changed files)\n```\n\n## Inputs\n\n* GITHUB_REF: Use ${{ github.ref }}\n## Outputs\n\n* BRANCH\n* BRANCH_SLUG\n* GIT_SHA\n\n## Example usage\n\n```\n      - name: Check out code\n        uses: actions/checkout@v2\n        with:\n          fetch-depth: 0 # need to checkout \"all commits\" for certain features to work (e.g., get all changed files)\n      - name: Extract branch name\n        id: extract_branch\n        uses: keptn/gh-action-extract-branch-name@main\n        with:\n          GITHUB_REF: ${{ github.ref }}\n      - name: Print outputs\n        run: |\n          echo \"GIT_SHA=${{ steps.extract_branch.outputs.GIT_SHA }}\"\n          echo \"BRANCH_SLUG=${{ steps.extract_branch.outputs.BRANCH_SLUG }}\"\n          echo \"BRANCH=${{ steps.extract_branch.outputs.BRANCH }}\"\n```\n\nFor a full example, please refer to [.github/workflows/main.yml](.github/workflows/main.yml).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeptn%2Fgh-action-extract-branch-name","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeptn%2Fgh-action-extract-branch-name","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeptn%2Fgh-action-extract-branch-name/lists"}