{"id":17866185,"url":"https://github.com/xt0rted/pull-request-comment-branch","last_synced_at":"2025-05-15T03:06:09.908Z","repository":{"id":37212495,"uuid":"239334489","full_name":"xt0rted/pull-request-comment-branch","owner":"xt0rted","description":"A GitHub Action to get the head ref and sha of a pull request comment","archived":false,"fork":false,"pushed_at":"2025-04-28T16:08:51.000Z","size":1434,"stargazers_count":91,"open_issues_count":17,"forks_count":33,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-05T19:43:21.899Z","etag":null,"topics":["comments","github-actions","hacktoberfest","pull-requests","workflows"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xt0rted.png","metadata":{"funding":{"github":"xt0rted","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2020-02-09T16:20:13.000Z","updated_at":"2025-04-28T16:08:55.000Z","dependencies_parsed_at":"2023-02-19T09:16:00.504Z","dependency_job_id":"7979d7d0-4ba1-4d9d-a8aa-e59c2121d88b","html_url":"https://github.com/xt0rted/pull-request-comment-branch","commit_stats":{"total_commits":408,"total_committers":4,"mean_commits":102.0,"dds":"0.39950980392156865","last_synced_commit":"96dcdbc05abf6bde3a6da1b021f408334dc1401d"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xt0rted%2Fpull-request-comment-branch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xt0rted%2Fpull-request-comment-branch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xt0rted%2Fpull-request-comment-branch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xt0rted%2Fpull-request-comment-branch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xt0rted","download_url":"https://codeload.github.com/xt0rted/pull-request-comment-branch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254264765,"owners_count":22041793,"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":["comments","github-actions","hacktoberfest","pull-requests","workflows"],"created_at":"2024-10-28T09:28:51.232Z","updated_at":"2025-05-15T03:06:09.890Z","avatar_url":"https://github.com/xt0rted.png","language":"TypeScript","readme":"# Pull Request Comment Branch\n\n[![CI](https://github.com/xt0rted/pull-request-comment-branch/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/xt0rted/pull-request-comment-branch/actions/workflows/ci.yml)\n[![CodeQL](https://github.com/xt0rted/pull-request-comment-branch/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)](https://github.com/xt0rted/pull-request-comment-branch/actions/workflows/codeql-analysis.yml)\n\nGet the head ref and sha of a pull request comment.\n\nWorkflows for pull request comments are triggered using the [`issue_comment`](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#issue-comment-event-issue_comment) event which runs for both issues and pull requests.\nThis action lets you filter your workflow to comments only on pull requests.\nIt also gets the head ref and sha for the pull request branch which can be used later in the workflow.\n\nThe pull request head ref and sha are important because `issue_comment` workflows run against the repository's `default` branch (usually `main` or `master`) and not the pull request's branch.\nWith this action you'll be able to pass the ref to [`actions/checkout`](https://github.com/actions/checkout) and work with the pull request's code.\n\n## Usage\n\n```yml\non:\n  issue_comment:\n    types: [created]\n\njobs:\n  pr-comment:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: xt0rted/pull-request-comment-branch@v3\n        id: comment-branch\n\n      - uses: actions/checkout@v3\n        if: success()\n        with:\n          ref: ${{ steps.comment-branch.outputs.head_ref }}\n\n      - run: git rev-parse --abbrev-ref HEAD\n      - run: git rev-parse --verify HEAD\n```\n\n## Token Permissions\n\nIf your repository is using [token permissions](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions) you'll need to set `contents: read`, `issues: read` and `pull-request: read` on either the workflow or the job.\n\n### Workflow Config\n\n```yml\non: issue_comment\npermissions:\n  contents: read\n  issues: read\n  pull-requests: read\njobs:\n  pr-comment:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: xt0rted/pull-request-comment-branch@v3\n```\n\n### Job Config\n\n```yml\non: issue_comment\njobs:\n  pr-comment:\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n      issues: read\n      pull-requests: read\n    steps:\n      - uses: xt0rted/pull-request-comment-branch@v3\n```\n\n## Options\n\n### Required\n\nName | Allowed values | Description\n-- | -- | --\n`repo_token` | `GITHUB_TOKEN` (default) or PAT | `GITHUB_TOKEN` token or a repo scoped PAT.\n\n## Outputs\n\nName | Decription\n-- | --\n`base_ref` | The name of the branch the pull request will merge into.\n`base_sha` | The head sha of the branch the pull request will merge into.\n`head_ref` | The name of the pull request branch the comment belongs to.\n`head_sha` | The head sha of the pull request branch the comment belongs to.\n\n## License\n\nThe scripts and documentation in this project are released under the [MIT License](LICENSE)\n","funding_links":["https://github.com/sponsors/xt0rted"],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxt0rted%2Fpull-request-comment-branch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxt0rted%2Fpull-request-comment-branch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxt0rted%2Fpull-request-comment-branch/lists"}