Skip to content

Commit 5e2cab4

Browse files
committed
Split workflow into separate jobs
1 parent aeedfd9 commit 5e2cab4

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

.github/workflows/qhelp-pr-preview.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Query help preview
22

33
permissions:
44
contents: read
5-
pull-requests: write
65

76
on:
87
pull_request_target:
@@ -14,6 +13,8 @@ on:
1413

1514
jobs:
1615
qhelp:
16+
permissions:
17+
contents: read
1718
runs-on: ubuntu-latest
1819
steps:
1920
- uses: github/codeql/.github/actions/fetch-codeql@main
@@ -32,14 +33,28 @@ jobs:
3233
3334
- name: QHelp preview
3435
run: |
35-
if [ -s "${{ runner.temp }}/paths.txt" ]; then
36-
( echo "QHelp previews:";
37-
cat "${{ runner.temp }}/paths.txt" | while read path; do
38-
echo "<details> <summary>${path}</summary>"
39-
echo
40-
codeql generate query-help --format=markdown "${path}"
41-
echo "</details>"
42-
done) | gh pr comment "${{ github.event.pull_request.number }}" -F -
43-
fi
36+
cat "${{ runner.temp }}/paths.txt" | while read path; do
37+
echo "<details> <summary>${path}</summary>"
38+
echo
39+
codeql generate query-help --format=markdown "${path}"
40+
echo "</details>"
41+
done > comment.txt
42+
43+
- uses: actions/upload-artifact@v2
44+
with:
45+
name: comment.txt
46+
path: comment.txt
47+
48+
post_comment:
49+
permissions:
50+
pull-requests: write
51+
runs-on: ubuntu-latest
52+
needs: qhelp
53+
steps:
54+
- uses: actions/download-artifact@v2
55+
with:
56+
name: comment.txt
57+
- run: |
58+
(echo "QHelp previews:"; cat comment.txt) | gh pr comment "${{ github.event.pull_request.number }}" --repo "${{ github.repository }}" -F -
4459
env:
4560
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)