repoman-check-on-pr.yml: hide outdated results (#967)
hide all outdated results before a new result posts Signed-off-by: bekcpear <i@bitbili.net>
This commit is contained in:
1 parent
516e793fab
commit
600d813bec
1 file changed
+34
@@ -157,6 +157,40 @@ jobs:
|
||||
echo "::set-output name=stateicon::x"
|
||||
exit 1
|
||||
fi
|
||||
- name: Hide previous results
|
||||
if: ${{ always() }}
|
||||
shell: bash
|
||||
env:
|
||||
COMMENTS_URL: ${{ github.event.pull_request.comments_url }}
|
||||
COMMENTS_JSON: /tmp/comments.json
|
||||
run: |
|
||||
curl -H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-o ${COMMENTS_JSON} ${COMMENTS_URL}
|
||||
node_ids=( $(<${COMMENTS_JSON} jq '.[] | select(.body|test("^##\\s*[a-zA-Z_:]+\\s*repoman\\s*checks")) | select(.user.id == 41898282) | .node_id' | cut -d'"' -f2) )
|
||||
echo "${node_ids[@]}"
|
||||
json="{ \"query\": \"mutation {
|
||||
minimizeComment(input: {
|
||||
subjectId: \\\"NODEID\\\",
|
||||
classifier: OUTDATED
|
||||
}) {
|
||||
clientMutationId,
|
||||
minimizedComment {
|
||||
isMinimized,
|
||||
minimizedReason,
|
||||
viewerCanMinimize
|
||||
}
|
||||
}
|
||||
}\"
|
||||
}"
|
||||
json=$(tr -d '\n' <<<${json})
|
||||
for node_id in ${node_ids[@]}; do
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-d "${json/NODEID/${node_id}}" \
|
||||
https://api.github.com/graphql
|
||||
done
|
||||
- name: Post result
|
||||
if: ${{ always() }}
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
|
||||
Reference in new issue
Block a user