gh-issue-add-comment
This promotion step is only available in Kargo on the Akuity Platform, versions v1.11.0 and above.
The gh-issue-add-comment step posts a comment on an existing GitHub issue or pull
request. The returned commentID can be passed to
gh-issue-update-comment or
gh-issue-delete-comment in later steps.
In GitHub, pull requests share the same number space as issues. Passing a PR
number as issueNumber posts a comment on the PR's conversation thread. The
url in the step output automatically points to the PR (/pull/) rather than
the issue (/issues/), because GitHub's API returns the correct URL based on
whether the number belongs to a PR or an issue.
GitHub Issues integration for Kargo is a group of promotion steps:
- gh-issue-add-comment
- gh-create-issue
- gh-issue-delete-comment
- gh-search-issues
- gh-issue-update-comment
- gh-update-issue
- gh-wait-for-issue-state
Credentials
These steps use the same
repository credentials
that git-clone and git-open-pr use
for the same repository. If you have already configured a Git credential for
the repoURL, no additional setup is required.
The GitHub token must have Issues: Read and write access for the repository
(or the repo scope for a classic personal access token).
Configuration
| Name | Type | Required | Description |
|---|---|---|---|
repoURL | string | Y | The URL of the GitHub repository (e.g. https://github.com/owner/repo). |
insecureSkipTLSVerify | boolean | N | If true, TLS verification of the GitHub server certificate is skipped. Use only for GitHub Enterprise Server instances with self-signed certificates. |
issueNumber | integer | Y | The number of the issue or pull request to comment on. Pull requests and issues share the same number space in GitHub, so this field works for both. |
body | string | Y | The body text of the comment. Supports GitHub Flavored Markdown. |
Output
| Name | Type | Description |
|---|---|---|
commentID | integer | The ID of the created comment. |
url | string | The HTML URL of the created comment. |
Examples
Comment on an issue
Posts a comment when a promotion starts and removes it if the promotion fails:
steps:
- as: post-comment
uses: gh-issue-add-comment
config:
repoURL: https://github.com/myorg/myrepo
issueNumber: ${{ freightMetadata(ctx.targetFreight.name)['github-issue-number'] }}
body: |
Promotion to **${{ ctx.stage }}** started.
Image: `${{ imageFrom(vars.imageRepo).RepoURL }}:${{ imageFrom(vars.imageRepo).Tag }}`
# ... your promotion steps ...
- uses: gh-issue-delete-comment
if: ${{ failure() && status('post-comment') == 'Succeeded' }}
config:
repoURL: https://github.com/myorg/myrepo
commentID: ${{ outputs['post-comment'].commentID }}
Comment on a pull request
Posts a promotion status comment directly on the PR that triggered the promotion. The PR number is stored in freight metadata by an upstream step:
steps:
- uses: gh-issue-add-comment
config:
repoURL: https://github.com/myorg/myrepo
issueNumber: ${{ freightMetadata(ctx.targetFreight.name)['github-pr-number'] }}
body: |
Promoted to **${{ ctx.stage }}** successfully.