소스 검색

Pass along the PR diff via environment variable instead of outputs

Tianon Gravi 5 년 전
부모
커밋
6e417c94f7
1개의 변경된 파일11개의 추가작업 그리고 5개의 파일을 삭제
  1. 11 5
      .github/workflows/munge-pr.yml

+ 11 - 5
.github/workflows/munge-pr.yml

@@ -69,8 +69,14 @@ jobs:
           bashbrew --version > /dev/null
           diff="$(./diff-pr.sh "$GITHUB_PR_NUMBER" | tee /dev/stderr)"
           set +x
-          json="$(jq <<<"$diff" -Rcs '{ diff: ., length: length }')"
-          echo "::set-output name=diff::$json"
+          {
+            diffMarker="ENDOFOIPRDIFF$RANDOM$RANDOM$RANDOM"
+            echo "PR_DIFF<<$diffMarker"
+            echo "$diff"
+            echo "$diffMarker"
+          } >> "$GITHUB_ENV"
+          length="$(jq <<<"$diff" -Rcs 'length')"
+          echo "::set-output name=length::$length"
       - name: Comment
         uses: actions/github-script@v3
         with:
@@ -98,8 +104,8 @@ jobs:
               }
             }
             if (needNewComment) {
-              const data = ${{ steps.diff.outputs.diff }};
-              const body = "<details>\n<summary>" + commentText + "</summary>\n\n```diff\n" + data.diff + "\n```\n\n</details>";
+              const diff = process.env.PR_DIFF;
+              const body = "<details>\n<summary>" + commentText + "</summary>\n\n```diff\n" + diff + "\n```\n\n</details>";
               await github.issues.createComment({
                 owner: context.repo.owner,
                 repo: context.repo.repo,
@@ -107,4 +113,4 @@ jobs:
                 body: body,
               });
             }
-        if: fromJSON(steps.diff.outputs.diff).length > 0
+        if: fromJSON(steps.diff.outputs.length) > 0