From 7f7f0a099a03d55e1e14ae95c737b0c43c7abf6e Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Thu, 12 Oct 2023 14:11:54 +0200 Subject: [PATCH] Propagate deleted discussions to the error database --- .github/workflows/error-db.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/error-db.yml b/.github/workflows/error-db.yml index 57c5ca057..e885af4a2 100644 --- a/.github/workflows/error-db.yml +++ b/.github/workflows/error-db.yml @@ -12,6 +12,7 @@ jobs: if: github.event.discussion.category.name == 'Errors' steps: - name: Query Discussion Data + if: github.event_name == 'discussion_comment' || github.event_name == 'discussion' && github.event.action != 'deleted' id: query-data uses: actions/github-script@v6 with: @@ -47,8 +48,13 @@ jobs: - name: Merge Error Code Data run: | jq -c '.' ${{ steps.get-gist.outputs.file }} > original.json - echo $DISCUSSION | jq -c '.repository.discussion | .comments = .comments.totalCount | {(.id|tostring) : .}' > new.json - jq -s '.[0] * .[1]' original.json new.json > merged.json + if [ ! -z "$DISCUSSION" ] + then + echo $DISCUSSION | jq -c '.repository.discussion | .comments = .comments.totalCount | {(.id|tostring) : .}' > new.json + jq -s '.[0] * .[1]' original.json new.json > merged.json + else + cat original.json | jq 'del(.[] | select(.url=="https://github.com/cryptomator/cryptomator/discussions/${{ github.event.discussion.number }}"))' > merged.json + fi env: DISCUSSION: ${{ steps.query-data.outputs.result }} - name: Patch Gist