{"id":18815184,"url":"https://github.com/nderjung/concourse-github-pr-comment-resource","last_synced_at":"2025-04-13T21:42:40.129Z","repository":{"id":46708946,"uuid":"311670909","full_name":"nderjung/concourse-github-pr-comment-resource","owner":"nderjung","description":"A Concourse resource which monitors incoming comments or reviews on a Github Pull Request and is able to filter text matching regular expressions, the author's association with the project, the pull request's state and any labels it has been assigned.","archived":false,"fork":false,"pushed_at":"2022-09-06T17:18:45.000Z","size":93,"stargazers_count":7,"open_issues_count":1,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T12:06:38.308Z","etag":null,"topics":["ci","ci-cd","concourse","continious-integration","continuous-delivery","go","pipelines"],"latest_commit_sha":null,"homepage":"https://github.com/nderjung/concourse-github-pr-comment-resource","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nderjung.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":"2020-11-10T13:43:19.000Z","updated_at":"2023-03-05T06:10:43.000Z","dependencies_parsed_at":"2022-07-19T22:04:03.215Z","dependency_job_id":null,"html_url":"https://github.com/nderjung/concourse-github-pr-comment-resource","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nderjung%2Fconcourse-github-pr-comment-resource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nderjung%2Fconcourse-github-pr-comment-resource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nderjung%2Fconcourse-github-pr-comment-resource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nderjung%2Fconcourse-github-pr-comment-resource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nderjung","download_url":"https://codeload.github.com/nderjung/concourse-github-pr-comment-resource/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788867,"owners_count":21161726,"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":["ci","ci-cd","concourse","continious-integration","continuous-delivery","go","pipelines"],"created_at":"2024-11-07T23:48:01.126Z","updated_at":"2025-04-13T21:42:40.101Z","avatar_url":"https://github.com/nderjung.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# concourse-github-pr-comment-resource\n\n![resource-pipeline](https://github.com/nderjung/concourse-github-pr-comment-resource/workflows/resource-pipeline/badge.svg)\n\nThis Concourse resource monitors incoming comments on a Github Pull Request and\nis able to monitor for comments matching regular expressions, match comment\nauthor's association with the project, the pull request's state and any labels\nit has been assigned.\n\nInspired by [`telia-oss/github-pr-resource`](https://github.com/telia-oss/github-pr-resource)\nwith the aim of providing a resource which reacts solely on the newest comment\nto a particular pull request of a repository.\n\n## Source configuration\n\nThe following parameters are used for the resource's `source` configuration:\n\n| Parameter               | Required | Example                                     | Default                  | Description                                                                                                                                                                                                                                   |\n| ----------------------- | -------- | ------------------------------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `repository`            | Yes      | `nderjung/limp`                             |                          | The repository to listen for PR comments on.                                                                                                                                                                                                  |\n| `disable_git_lfs`       | No       | `true`                                      | `false`                  | Disable Git LFS, skipping an attempt to convert pointers of files tracked into their corresponding objects when checked out into a working copy.                                                                                              |\n| `access_token`          | Yes      |                                             |                          | The [personal access token](https://github.com/settings/tokens/new) of the account used to access, monitor and post comments on the repository in question.                                                                                   |\n| `github_endpoint`       | No       |                                             | `https://api.github.com` | Endpoint used to connect to the Github v3 API.                                                                                                                                                                                                |\n| `skip_ssl`              | No       | `true`                                      | `false`                  | Whether to skip SSL verification of the Github API.                                                                                                                                                                                           |\n| `only_mergeable`        | No       | `true`                                      | `false`                  | Whether to react to (non-)mergeable pull requests.                                                                                                                                                                                            |\n| `states`                | No       | `[\"closed\"]`                                | `[\"open\"]`               | The state of the pull request to react on.                                                                                                                                                                                                    |\n| `ignore_drafts`         | No       | `true`                                      | `false`                  | Disable triggering of the resource if the pull request is in Draft status.                                                                                                                                                                    |\n| `ignore_states`         | No       | `[\"open\"]`                                  | `[]`                     | The state of the pull request to not react on.                                                                                                                                                                                                |\n| `labels`                | No       | `[\"bug\"]`                                   | `[]`                     | The labels of the pull request to react on.                                                                                                                                                                                                   |\n| `ignore_labels`         | No       | `[\"lifecycle/stale\"]`                       | `[]`                     | The labels of the pull request not to react on.                                                                                                                                                                                               |\n| `comments`              | No       | `[\"^ping$\"]`                                | `[]`                     | The regular expressions of the latest comment to react on.                                                                                                                                                                                    |\n| `commenter_association` | No       | `[\"first_time_contributor\", \"first_timer\"]` | `[\"all\"]`                | The comment author's relationship with the pull request's repository. Possible values include any of or any combination of `\"collaborator\"`, `\"contributor\"`, `\"first_timer\"`, `\"first_time_contributor\"`, `\"member\"`, `\"owner\"`, or `\"all\"`. |\n| `ignore_comments`       | No       | `[\"ing$\"]`                                  | `[]`                     | The regular expressions of the latest comment not to react on.                                                                                                                                                                                |\n| `map_comment_meta`      | No       | `true`                                      | `false`                  | Whether to map any regular expression keys and their corresponding values to the meta object provided in `in`.                                                                                                                                |\n| `review_states`         | No       | `[\"commented\", \"changes_requested\"]`        | `[]`                     | The state of the review, any combination of `approved`, `changes_requeste` and/or `commented`.                                                                                                                                                |\n| `when`                  | No       | `first`                                     | `latest`                 | The comment or review to select, one of either `all`, `latest` or `first`.                                                                                                                                                                    |\n\n## Behaviour\n\n### `check`\n\nProduces new versions for all new comments to pull requests matching the\ncriteria set by the resource's `source` configuration.  The version provided to\nConcourse is Github's unique numerical ID for the comment.\n\n### `in`\n\nThe following parameters may be used in the `get` step of the resource:\n\n| Parameter          | Required | Default       | Description                                                                  |\n| ------------------ | -------- | ------------- | ---------------------------------------------------------------------------- |\n| `comment_file`     | No       | `comment.txt` | A unique path to save the body of the comment.                               |\n| `source_path`      | No       | `source`      | The path to save the source within the resource.                             |\n| `git_depth`        | No       | `0`           | Git clone depth.                                                             |\n| `submodules`       | No       | `false`       | Whether to clone Git submodules.                                             |\n| `fetch_tags`       | No       | `false`       | Whether to fetch Git tags.                                                   |\n| `integration_tool` | No       | `rebase`      | How to merge the PR source, selection between `rebase`, `merge`, `checkout`. |\n| `skip_download`    | No       | `false`       | Does not clone the pull request.                                             |\n\nThe `in` procedure of this resource retrieves the following metadata about the\npull request comment and saves the key as the filename to the `path` set by the\nresource.\n\n| Key                  | Description                                                               |\n| -------------------- | ------------------------------------------------------------------------- |\n| `pr_id`              | The ID of the pull request relative to the repository.                    |\n| `comment_id`         | The unique ID provided by Github for the comment.                         |\n| `body`               | The content of the comment.                                               |\n| `created_at`         | The [timestamp](https://golang.org/pkg/time/#Time.String) of the comment. |\n| `updated_at`         | The timestamp of when the comment was last updated.                       |\n| `author_association` | The association the author of the comment has with the repository.        |\n| `html_url`           | The URL to the comment.                                                   |\n| `user_id`            | The unique ID of the comment author on Github.                            |\n| `user_login`         | The username of the comment author on Github.                             |\n| `user_name`          | The name of the comment author on Github.                                 |\n| `user_email`         | The email of the comment author on Github.                                |\n| `user_avatar_url`    | The avatar URL for the comment author.                                    |\n| `user_html_url`      | The URL to the comment author's profile on Github.                        |\n| `pr_head_ref`        | The branch name from the HEAD of Pull Request.                            |\n| `pr_head_sha`        | The commit SHA from the HEAD of the Pull Request.                         |\n| `pr_base_ref`        | The branch name from the base of the Pull Request.                        |\n| `pr_base_sha`        | The commit SHA from the base of the Pull Request.                         |\n\nAdditionally, the `in`/get step of this resource produces two additional JSON\nformatted files which contain the information about the PR comment:\n\n * `version.json` which contains only contains the unique ID of the Github\n   comment to the PR; and,\n * `metadata.json` which contains a serialized version of the table above,\n * Any additional attributes mapped from parsing comments using Golang's name\n   grouping.  More details can be found [here](https://golang.org/pkg/regexp/syntax/).\n\n### `out`\n\n| Parameter             | Required | Example           | Default | Description                                                         |\n| --------------------- | -------- | ----------------- | ------- | ------------------------------------------------------------------- |\n| `path`                | Yes      | `pr-comment`      |         | The name given to the resource in a in/get step.                    |\n| `state`               | No       | `closed`          |         | The state to set the PR.  Options include `open` and `closed`.      |\n| `comment`             | No       | `pong`            |         | The string to use as a new comment on the PR.                       |\n| `comment_file`        | No       | `pong.txt`        |         | The path to the file to read and post as a new comment on the PR.   |\n| `labels`              | No       | `[\"\"]`            |         | The finite set of labels to replace on the PR.                      |\n| `add_labels`          | No       | `[\"cicd/tested\"]` |         | Additional labels to add to the PR.                                 |\n| `remove_labels`       | No       | `[\"cicd/await\"]`  |         | Labels to remove from the PR.                                       |\n| `delete_last_comment` | No       | `true`            | `false` | Whether or not to delete the last comment of the PR comment thread. |\n\n\nNote that `comment` and `comment_file` will all expand all [Concourse environment variables](https://concourse-ci.org/implementing-resource-types.html#resource-metadata).\n\n#### Notes\n\n * The author of the comment will be that of the user whose access token is used\n   in the resource's `source` configuration.\n\n## Example\n\nThe following represents a simple \"ping-pong\" setup, where Concourse is able to\nuse this resource to react to comments to a PR with the single term \"ping\" with\na comment \"pong\":\n\n```yaml\nresource_types:\n  - name: github-pr-comment-resource\n    type: docker-image\n    source:\n      repository: ndrjng/concourse-github-pr-comment-resource\n      tag: latest\n\nresources:\n  - name: github-pr-comment-ping\n    type: github-pr-comment-resource\n    icon: magnify\n    source:\n      repository: nderjung/limp\n      access_token: ((github.access-token))\n      comments: [\"^ping$\"]\n\njobs:\n  - name: pong\n    serial: true\n    plan:\n      - get: github-pr-comment-ping\n        trigger: true\n        version: every\n\n      - put: github-pr-comment-ping\n        params:\n          path: github-pr-comment-ping\n          comment: \"pong\"\n```\n\n## License\n\nBSD-3-Clause.  See [`LICENSE`](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnderjung%2Fconcourse-github-pr-comment-resource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnderjung%2Fconcourse-github-pr-comment-resource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnderjung%2Fconcourse-github-pr-comment-resource/lists"}