{"id":14986066,"url":"https://github.com/petehouston/github-actions-query-branch-name","last_synced_at":"2026-01-04T07:57:27.224Z","repository":{"id":52661695,"uuid":"360279219","full_name":"petehouston/github-actions-query-branch-name","owner":"petehouston","description":"Get pure Git branch name","archived":false,"fork":false,"pushed_at":"2023-07-20T16:25:45.000Z","size":36,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T02:48:38.894Z","etag":null,"topics":["github-actions","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petehouston.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-21T19:10:21.000Z","updated_at":"2023-09-17T00:36:37.000Z","dependencies_parsed_at":"2024-09-24T15:48:03.609Z","dependency_job_id":null,"html_url":"https://github.com/petehouston/github-actions-query-branch-name","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"892c80ceeff6234cd58701b5fea41e43b0398048"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petehouston%2Fgithub-actions-query-branch-name","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petehouston%2Fgithub-actions-query-branch-name/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petehouston%2Fgithub-actions-query-branch-name/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petehouston%2Fgithub-actions-query-branch-name/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petehouston","download_url":"https://codeload.github.com/petehouston/github-actions-query-branch-name/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244826602,"owners_count":20516788,"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":["github-actions","hacktoberfest"],"created_at":"2024-09-24T14:12:16.108Z","updated_at":"2026-01-04T07:57:27.171Z","avatar_url":"https://github.com/petehouston.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Github Actions: Query Git branch name\n\nGet pure Git branch name without `***/ref/` prefix.\n\n## Inputs\n\n### `name`\n\n**Required** The environment variable name to export, ex. `CURRENT_BRANCH`, `GIT_BRANCH`. Default `\"GIT_BRANCH_NAME\"`.\n\nOn `pull_request` event, two additional environment variables are exported for `HEAD` and `BASE`. The env names are suffixed with `_HEAD` and `_BASE`. By default, they are `GIT_BRANCH_NAME_HEAD` and `GIT_BRANCH_NAME_BASE`.\n\n## Outputs\n\n### `git_branch_name`\n\nThe current Git branch name.\n\nOn `pull_request` event, it is the same as `git_branch_name_head`.\n\n### `git_branch_name_head`\n\nThe current Git branch name at `HEAD`. Only available on `pull_request` event.\n\n### `git_branch_name_base`\n\nThe current Git branch name at `BASE`. Only available on `pull_request` event.\n\n## Example usage\n\nExport to default environment variable `GIT_BRANCH_NAME`.\n```yaml\nuses: petehouston/github-actions-query-branch-name@v1.2\n```\n\nExport to custom environment variable, ex. `MY_BRANCH`\n```yaml\nuses: petehouston/github-actions-query-branch-name@v1.2\nwith:\n  name: MY_BRANCH\n```\n\nGet branch name from output.\n```yaml\n- name: Query Git branch name\n  uses: petehouston/github-actions-query-branch-name@v1.2\n  id: queryBranch\n- name: Get Git branch name\n  run: |-\n    echo \"GIT_BRANCH_NAME = $GIT_BRANCH_NAME\"\n    echo \"Branch name: ${{ steps.queryBranch.outputs.git_branch_name }}\"\n```\n\nGet branch name from `pull_request`.\n```yaml\n- name: Query Git branch name\n  uses: petehouston/github-actions-query-branch-name@v1.2\n  id: queryBranch\n- name: Get Git branch name only on pull request\n  if: github.event_name == 'pull_request'\n  run: |-\n    echo \"GIT_BRANCH_NAME = $GIT_BRANCH_NAME\"\n    echo \"GIT_BRANCH_NAME_HEAD = $GIT_BRANCH_NAME_BEAD\"\n    echo \"GIT_BRANCH_NAME_BASE = $GIT_BRANCH_NAME_BASE\"\n    echo \"Branch name: ${{ steps.queryBranch.outputs.git_branch_name }}\"\n    echo \"Branch name: ${{ steps.queryBranch.outputs.git_branch_name_head }}\"\n    echo \"Branch name: ${{ steps.queryBranch.outputs.git_branch_name_base }}\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetehouston%2Fgithub-actions-query-branch-name","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetehouston%2Fgithub-actions-query-branch-name","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetehouston%2Fgithub-actions-query-branch-name/lists"}