From dd5ef57f15d11397078c94e637bf83ee6b873551 Mon Sep 17 00:00:00 2001 From: Akuli Date: Wed, 8 Jan 2025 23:15:19 +0200 Subject: [PATCH] Improve the valgrind workflow (#571) --- .github/workflows/valgrind.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index d5294d61..f9970a9f 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -47,18 +47,19 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 needs: [valgrind] - #if: ${{ github.repository == 'Akuli/jou' && always() && github.event_name == 'schedule' && needs.valgrind.result == 'failure' }} - if: ${{ github.repository == 'Akuli/jou' && always() && needs.valgrind.result == 'failure' }} + if: ${{ github.repository == 'Akuli/jou' && always() && github.event_name == 'schedule' && needs.valgrind.result == 'failure' }} permissions: issues: write steps: - - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - await github.rest.issues.create({ - owner: "Akuli", - repo: "jou", - title: `Running tests with valgrind failed on ${new Date().toDateString()}`, - body: "See valgrind output here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", - }) + - run: | + echo "Checking if there is already an issue about valgrind errors..." + if curl -s 'https://api.github.com/repos/${{ github.repository }}/issues?state=open' | jq '.[].title' | grep "Running tests with valgrind failed"; then + echo "There is already an open issue about the valgrind errors. Not creating a new one." + else + echo "No open issue found, creating a new one." + curl -s -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/${{ github.repository }}/issues \ + -d '{"title": "Running tests with valgrind failed", "body": "Valgrind output is here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' + fi