{"id":20532461,"url":"https://github.com/joshdk/drone-github-comment","last_synced_at":"2025-03-06T02:49:07.859Z","repository":{"id":40395342,"uuid":"474205335","full_name":"joshdk/drone-github-comment","owner":"joshdk","description":"💬 Drone plugin which takes the output of a step and comments on a Github pull request","archived":false,"fork":false,"pushed_at":"2022-08-31T16:04:06.000Z","size":64,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-16T13:17:28.317Z","etag":null,"topics":["drone","drone-ci","drone-plugin","github-api","go","golang"],"latest_commit_sha":null,"homepage":"https://ghcr.io/joshdk/drone-github-comment","language":"Go","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/joshdk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-26T00:53:30.000Z","updated_at":"2023-03-17T00:30:28.000Z","dependencies_parsed_at":"2022-08-09T19:10:51.839Z","dependency_job_id":null,"html_url":"https://github.com/joshdk/drone-github-comment","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fdrone-github-comment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fdrone-github-comment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fdrone-github-comment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshdk%2Fdrone-github-comment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshdk","download_url":"https://codeload.github.com/joshdk/drone-github-comment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242138802,"owners_count":20078007,"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":["drone","drone-ci","drone-plugin","github-api","go","golang"],"created_at":"2024-11-16T00:15:02.170Z","updated_at":"2025-03-06T02:49:07.838Z","avatar_url":"https://github.com/joshdk.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License][license-badge]][license-link]\n[![Actions][github-actions-badge]][github-actions-link]\n[![Releases][github-release-badge]][github-release-link]\n\n# Drone Github Comment Plugin\n\n💬 Drone plugin which takes the output of a step and comments on a Github pull request\n\n![pull request comment](https://user-images.githubusercontent.com/307183/162646831-7766bbb9-f815-4f32-87a3-a75796401411.png)\n\n## Motivations\n\nThis DroneCI plugin enables you to take the output from a target step and comment that output as a GitHub pull request comment.\nThis enables you to write single purpose steps that lint files, run tests, etc, that don't require any knowledge of the underlying pull request or the GitHub API.\n\n## Usage\n\nThis plugin can be added to your .drone.yml as a new step within an existing pipeline.\nSecrets for a `DRONE_TOKEN` as well as a `GITHUB_TOKEN` must be configured.\n\n```yaml\nsteps:\n- name: drone-github-comment\n  image: ghcr.io/joshdk/drone-github-comment:v0.3.0\n  environment:\n    DRONE_TOKEN:\n      from_secret: DRONE_TOKEN\n    GITHUB_TOKEN:\n      from_secret: GITHUB_TOKEN\n```\n\nYou then need to configure a target `step` name that refers to existing pipeline step.\nYou can either specify both the stage/step name, like `build-pull-request/lint-code` in the example below, or just the step name for convenience.\n\n```yaml\nkind: pipeline\nname: build-pull-request\nsteps:\n- name: lint-code\n  commands:\n  - \"golangci-lint run .\"\n\n- name: drone-github-comment\n  image: ghcr.io/joshdk/drone-github-comment:v0.3.0\n  settings:\n    step: build-pull-request/lint-code\n    #step: lint-code\n```\n\nYou must also configure the `depends_on` values, since this plugin must be run after the target step finishes.\n\n```yaml\nsteps:\n- name: drone-github-comment\n  image: ghcr.io/joshdk/drone-github-comment:v0.3.0\n  depends_on:\n  - lint-code\n```\n\nYou should also configure the `when` values, since this plugin might be run after the target step fails.\n\n```yaml\nsteps:\n- name: drone-github-comment\n  image: ghcr.io/joshdk/drone-github-comment:v0.3.0\n  when:\n    status:\n      - failure\n```\n\nComments posted by previous runs are considered out of date, and are automatically deleted on subsequent runs.\nTo avoid the deletion of out of date comments, you can set `keep` to `true`.\n\n```yaml\nsteps:\n- name: drone-github-comment\n  image: ghcr.io/joshdk/drone-github-comment:v0.3.0\n  settings:\n    keep: true\n```\n\nYou may want to only post a comment when the target step succeeds or fails.\nYou can use set `when` to `success`, `failure`, or `always`.\nThis setting defaults to `always`.\nNote that the `when` setting is different to the `when` step property.\n\n```yaml\nsteps:\n- name: drone-github-comment\n  image: ghcr.io/joshdk/drone-github-comment:v0.3.0\n  settings:\n    when: failure\n```\n\nTarget steps often run a series of shell `commands`, which print each command run using `set -e`.\nThese lines, which start with a `+` symbol, are automatically ignored.\nTo include such lines, you can set `verbatim` to `true`.\n\n```yaml\nsteps:\n- name: drone-github-comment\n  image: ghcr.io/joshdk/drone-github-comment:v0.3.0\n  settings:\n    verbatim: true\n```\n\n## License\n\nThis code is distributed under the [MIT License][license-link], see [LICENSE.txt][license-file] for more information.\n\n[github-actions-badge]:  https://github.com/joshdk/drone-github-comment/workflows/Build/badge.svg\n[github-actions-link]:   https://github.com/joshdk/drone-github-comment/actions\n[github-release-badge]:  https://img.shields.io/github/release/joshdk/drone-github-comment/all.svg\n[github-release-link]:   https://github.com/joshdk/drone-github-comment/releases\n[license-badge]:         https://img.shields.io/badge/license-MIT-green.svg\n[license-file]:          https://github.com/joshdk/drone-github-comment/blob/master/LICENSE.txt\n[license-link]:          https://opensource.org/licenses/MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshdk%2Fdrone-github-comment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshdk%2Fdrone-github-comment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshdk%2Fdrone-github-comment/lists"}