From 4dd58a664ec03e818c313165a91cdb568beb0639 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Fri, 8 Jul 2022 12:48:50 +0200 Subject: [PATCH] Update error-db.yml add discussion data to errorcodes.json gist [ci skip] --- .github/workflows/error-db.yml | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/.github/workflows/error-db.yml b/.github/workflows/error-db.yml index f04e7a6e5..fb9404cb1 100644 --- a/.github/workflows/error-db.yml +++ b/.github/workflows/error-db.yml @@ -20,10 +20,8 @@ jobs: repository(owner: $owner, name: $name) { discussion(number: $discussionNumber) { title - bodyHTML url answer { - bodyHTML url } comments { @@ -38,15 +36,24 @@ jobs: discussionNumber: context.payload.discussion.number } return await github.graphql(query, variables) - - name: Transform JSON - id: transform-json + - name: Get Gist + id: get-gist + uses: sergeysova/gist-read-action@v1 + with: + gist_id: accba9fb9555e7192271b85606f97230 + file_name: errorcodes.json + - name: Merge Error Code Data run: | - RESULT=$(echo ${JSON_DATA} | jq -c '.repository.discussion | .comments = .comments.totalCount') - echo "::set-output name=result::${RESULT}" + echo $GIST_DATA | jq -c '.' > original.json + echo $DISCUSSION | jq -c '.repository.discussion | .comments = .comments.totalCount' | .answer = .answer.url | {(.title|tostring) : .}' > new.json + jq -s '.[0] * .[1]' new.json original.json > merged.json env: - JSON_DATA: ${{ steps.query-data.outputs.result }} - - name: Update Database - run: | - echo TODO - env: - JSON_DATA: ${{ steps.transform-json.outputs.result }} + DISCUSSION: ${{ steps.query-data.outputs.result }} + GIST_DATA: ${{ steps.get-gist.outputs.content }} + - name: Patch Gist + uses: exuanbo/actions-deploy-gist@v1 + with: + token: ${{ secrets.CRYPTOBOT_GIST_TOKEN }} + gist_id: accba9fb9555e7192271b85606f97230 + gist_file_name: errorcodes.json + file_path: merged.json