This is an automated email from the ASF dual-hosted git repository.

casion pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-linkis-website.git


The following commit(s) were added to refs/heads/dev by this push:
     new 420b1ae7e3 Fix a problem of automatically closing the issue robot 
(#410)
420b1ae7e3 is described below

commit 420b1ae7e3e3350c698a7c7509dc132ffe9d0947
Author: Beacontownfc <[email protected]>
AuthorDate: Thu Jul 7 10:43:32 2022 +0800

    Fix a problem of automatically closing the issue robot (#410)
    
    Update auto-close-issue.yml
---
 .github/actions/Auto_close_associate_issue/main.js | 10 +++++++++-
 .github/workflows/auto-close-issue.yml             |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/.github/actions/Auto_close_associate_issue/main.js 
b/.github/actions/Auto_close_associate_issue/main.js
index 78f9fdd7af..fe7067bde0 100644
--- a/.github/actions/Auto_close_associate_issue/main.js
+++ b/.github/actions/Auto_close_associate_issue/main.js
@@ -2,6 +2,14 @@ let body = process.env['INPUT_PRBODY'];
 
 let pattern = /#\d+/;
 
-let issueNumber = body.match(pattern)[0].replace('#', '');
+let issueNumber;
+
+try {
+    issueNumber = body.match(pattern)[0].replace('#', '');
+} catch{
+    issueNumber = -1;
+}
+
 
 console.log(`::set-output name=issueNumber::${issueNumber}`);
+
diff --git a/.github/workflows/auto-close-issue.yml 
b/.github/workflows/auto-close-issue.yml
index b8049b8389..f6c00f900f 100644
--- a/.github/workflows/auto-close-issue.yml
+++ b/.github/workflows/auto-close-issue.yml
@@ -20,7 +20,7 @@ jobs:
         uses: peter-evans/close-issue@v2
         if: ${{ github.event.pull_request.merged }}
         with:
-          issue-number: ${{ steps.Closer.outputs.issueNumber }}
+          issue-number: ${{ steps.Closer.outputs.issueNumber && 
steps.Closer.outputs.issueNumber != -1 }}
           comment: The associated PR has been merged, this issue is 
automatically closed, you can reopend if necessary.
         env:
           Github_Token: ${{ secrets.GITHUB_TOKEN }}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to