From deed7e002210c6c3db20a9086290a751922574aa Mon Sep 17 00:00:00 2001 From: Noxcis Date: Sat, 24 Aug 2024 02:56:40 -0500 Subject: [PATCH] Update main.yml --- .github/workflows/main.yml | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c42fb2e..2ba2ab4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,20 +44,13 @@ jobs: cat scout-results.txt # Print the report to the workflow logs for easy viewing echo "Docker Scout analysis completed." - - name: Create GitHub issue comment - uses: peter-evans/create-issue-comment@v3 - with: - issue-number: 1 # Replace with the issue number or use an appropriate method to identify the issue or PR - body: | - **Docker Image Build and Analysis Report** - - The Docker image was built and analyzed successfully. - - **Build Summary:** - - Image Tag: my-app-image:latest - - **Analysis Report:** - ``` - $(cat scout-results.txt) - ``` - token: ${{ secrets.GITHUB_TOKEN }} + - name: Post Comment on Issue or PR + run: | + COMMENT="**Docker Image Build and Analysis Report**\n\nThe Docker image was built and analyzed successfully.\n\n**Build Summary:**\n- Image Tag: my-app-image:latest\n\n**Analysis Report:**\n\`\`\`\n$(cat scout-results.txt)\n\`\`\`" + + # Post comment using GitHub API + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + -d "{\"body\": \"$COMMENT\"}" \ + "https://api.github.com/repos/${{ github.repository }}/issues/1/comments" # Replace '1' with the issue or PR number