Skip to content

Commit

Permalink
Add github post comment command
Browse files Browse the repository at this point in the history
  • Loading branch information
zyassine committed Oct 8, 2024
1 parent abd179f commit 997cbff
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/commands/github_post_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---

description: Post a comment under a github PR.

parameters:
comment:
type: string
default: "/review"
description: Comment to post.

steps:
- run:
name: Post comment under PR
command: >-
PR_NUMBER=$(echo "${CIRCLE_PULL_REQUEST}" | awk -F '/' '{print $NF}')
BASE_URL="https://api.github.com/repos/noosenergy/${CIRCLE_PROJECT_REPONAME}"
set -- "$@" -X POST
set -- "$@" -H "Accept: application/vnd.github+json"
set -- "$@" -H "Authorization: Bearer ${GITHUB_TOKEN}"
set -- "$@" -H "X-GitHub-Api-Version: 2022-11-28"
set -- "$@" ${BASE_URL}/issues/${PR_NUMBER}/comments
set -- "$@" -d "{\"body\": \"<< parameters.comment >>\"}"
curl "$@"

0 comments on commit 997cbff

Please sign in to comment.