diff --git a/.github/workflows/validate_issue.yaml b/.github/workflows/validate_issue.yaml index 7f6393ee..849e669b 100644 --- a/.github/workflows/validate_issue.yaml +++ b/.github/workflows/validate_issue.yaml @@ -13,8 +13,7 @@ jobs: uses: actions/github-script@v6 with: script: | - const issue = context.issue; - const createdAt = new Date(issue.created_at); + const createdAt = new Date("${{ github.event.issue.created_at }}"); const now = new Date(); const oneMinute = 60 * 1000; // milliseconds if (now - createdAt > oneMinute) { @@ -30,7 +29,7 @@ jobs: uses: actions/github-script@v6 with: script: | - const labels = github.event.issue.labels; + const labels = JSON.parse(`${{ toJSON(github.event.issue.labels) }}`).map(label => label.name); const isBugOrQuestion = labels.includes('bug') || labels.includes('question'); core.setOutput('isBugOrQuestion', isBugOrQuestion); @@ -39,7 +38,7 @@ jobs: uses: actions/github-script@v6 with: script: | - const body = github.event.issue.body; + const body = "${{ github.event.issue.body }}"; const versionRegex = /### 程序版本\s*(.+)\s*### 所使用的/; const versionMatch = body.match(versionRegex); let closeReasons = [];