From 5f3e071b64177ee61109693388689790b75f01ad Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Mon, 25 Mar 2024 13:12:46 +0000 Subject: [PATCH] Update empty-string-warning.yml --- .github/workflows/empty-string-warning.yml | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/empty-string-warning.yml b/.github/workflows/empty-string-warning.yml index d301868..baabff3 100644 --- a/.github/workflows/empty-string-warning.yml +++ b/.github/workflows/empty-string-warning.yml @@ -72,16 +72,19 @@ jobs: const body = "Empty string detected!"; const owner = context.repo.owner; const repo = context.repo.repo; - - - await github.rest.repos.createCommitComment({ - owner, - repo, - body, - commit_sha: context.payload.pull_request.head.sha, - path, - line: parseInt(line, 10), - }); + + try { + await github.rest.repos.createCommitComment({ + owner, + repo, + body, + commit_sha: context.payload.pull_request.head.sha, + path, + line: parseInt(line, 10), + }); + } catch (error) { + console.error(`Error posting comment to ${path}:${line}`, error); + } } env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}