fix: handle missing checkbox in close-dupes (#21689)

This commit is contained in:
bo0tzz 2025-09-10 03:46:59 +02:00 committed by GitHub
parent 2801b0953d
commit b97d73d7a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,20 +37,19 @@ jobs:
container: container:
image: yshavit/mdq:0.9.0@sha256:4399483ca857fb1a7ed28a596f754c7373e358647de31ce14b79a27c91e1e35e image: yshavit/mdq:0.9.0@sha256:4399483ca857fb1a7ed28a596f754c7373e358647de31ce14b79a27c91e1e35e
outputs: outputs:
json: ${{ steps.get_checkbox.outputs.json }} checked: ${{ steps.get_checkbox.outputs.checked }}
steps: steps:
- id: get_checkbox - id: get_checkbox
env: env:
BODY: ${{ needs.get_body.outputs.body }} BODY: ${{ needs.get_body.outputs.body }}
# TODO: We should detect if the checkbox is missing entirely and also close_and_comment in that case.
run: | run: |
JSON=$(echo "$BODY" | base64 -d | /mdq --output json '# I have searched | - [?] Yes') CHECKED=$(echo "$BODY" | base64 -d | /mdq --output json '# I have searched | - [?] Yes' | jq '.items[0].list[0].checked // false')
echo "json=$JSON" >> $GITHUB_OUTPUT echo "checked=$CHECKED" >> $GITHUB_OUTPUT
close_and_comment: close_and_comment:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [get_checkbox_json, should_run] needs: [get_checkbox_json, should_run]
if: ${{ needs.should_run.outputs.should_run == 'true' && !fromJSON(needs.get_checkbox_json.outputs.json).items[0].list[0].checked }} if: ${{ needs.should_run.outputs.should_run == 'true' && needs.get_checkbox_json.outputs.checked != 'true' }}
permissions: permissions:
issues: write issues: write
discussions: write discussions: write