From 7ff255d1e774bd0699c3b1d776f9eca185da3996 Mon Sep 17 00:00:00 2001 From: Keith Williams Date: Sat, 22 Jun 2024 04:59:40 -0300 Subject: [PATCH] fix: New CI workflow flaws in detecting the ready-for-e2e label on PRs (#15534) * logging the event * Added logging * Trying a different way to reference the event names * Trying to fix string issues * Clean up --- .github/workflows/pr.yml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 40b57091a3..0bc9055d51 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -42,19 +42,21 @@ jobs: with: script: | let pr; - if (github.event && github.event.pull_request) { + console.log('github.event_name', '${{ github.event_name }}'); + const parsedEvent = ${{ github.event }}; + if (parsedEvent && parsedEvent.pull_request) { const response = await github.rest.pulls.get({ owner: github.context.repo.owner, repo: github.context.repo.repo, - pull_number: github.event.pull_request.number + pull_number: parsedEvent.pull_request.number }); pr = response.data; } else { const ref = '${{ github.ref }}'; const branch = ref.replace('refs/heads/', ''); - console.log(ref); - console.log(branch); + console.log('ref', ref); + console.log('branch', branch); const response = await github.rest.pulls.list({ owner: context.repo.owner, repo: context.repo.repo, @@ -64,26 +66,20 @@ jobs: if (response.data.length > 0) { pr = response.data[0]; - } else { - core.setOutput('run-e2e', false); - console.log('No PR found matching the branch'); } } if (!pr) { + core.setOutput('run-e2e', false); console.log('No PR found'); return; } const labels = pr.labels.map(label => label.name); + const labelFound = labels.includes('ready-for-e2e'); console.log('PR #', pr.number); - if (labels.includes('ready-for-e2e')) { - core.setOutput('run-e2e', true); - console.log('Found the label'); - } else { - core.setOutput('run-e2e', false); - console.log('Did not find the label'); - } + console.log('Found the label?', labelFound); + core.setOutput('run-e2e', labelFound); type-check: name: Type check