From be09ba3edf7efc906aa3ef7af468911637480ea0 Mon Sep 17 00:00:00 2001 From: dan-mm Date: Thu, 2 Nov 2023 13:41:42 +0100 Subject: [PATCH] fix pr number on new comment --- action.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index c5d42423..0ea50e3e 100644 --- a/action.yml +++ b/action.yml @@ -156,8 +156,10 @@ runs: name: Minimize Old Comment and Post New Comment id: minimize-comment shell: bash + env: + PR_NUMBER: ${{ github.event.pull_request.number }} run: | - COMMENTS=$(curl -s -H "Authorization: Bearer ${{github.token}}" "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments") + COMMENTS=$(curl -s -H "Authorization: Bearer ${{github.token}}" "https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments") # Use jq to parse the comments and get comments made by this bot echo "$COMMENTS" | jq -c --arg username "github-actions[bot]" '.[] | select(.user.login == $username)' | while read -r comment; do @@ -171,7 +173,8 @@ runs: done NEW_COMMENT=$(cat "/tmp/eco-ci/output-pr.txt" | jq -Rs '.') - + echo "DMM --" + echo $NEW_COMMENT API_URL="${{ github.api_url }}/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" curl -X POST -H "Authorization: Bearer ${{github.token}}" -d @- $API_URL <