From c13cca4668f03abd93597ff974721da150b956c2 Mon Sep 17 00:00:00 2001 From: Daniel <77058885+0xDEnYO@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:30:00 +0700 Subject: [PATCH] =?UTF-8?q?adds=20a=20check=20if=20label=20AuditCompleted?= =?UTF-8?q?=20exists=20before=20trying=20to=20remove=20i=E2=80=A6=20(#805)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * adds a check if label AuditCompleted exists before trying to remove it (to prevent an error) * bugfix * change boolean value to string (in Bash) Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * adds missing bracket --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/workflows/verifyAudit.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verifyAudit.yml b/.github/workflows/verifyAudit.yml index 989586600..d27463381 100644 --- a/.github/workflows/verifyAudit.yml +++ b/.github/workflows/verifyAudit.yml @@ -78,6 +78,7 @@ jobs: with: script: | const { execSync } = require('child_process'); + // ANSI escape codes for colors (used for colored output in Git action console) const colors = { reset: "\033[0m", @@ -148,6 +149,13 @@ jobs: console.log(`${colors.green}Verified that exactly one label is assigned. Check passed :)${colors.reset}`); } + if(assignedLabels.includes('AuditCompleted')) { + console.log(`Label 'AuditCompleted' is currently assigned`); + core.exportVariable('AUDIT_COMPLETED_ASSIGNED', 'true'); + } + else + console.log(`Label 'AuditCompleted' is currently not assigned`); + - name: Check Audit Log continue-on-error: true id: check-audit-log @@ -384,7 +392,7 @@ jobs: - name: Remove label "AuditCompleted" in case check was not successful but label was assigned in earlier checks continue-on-error: true # This ensures the step will execute even if the job has a failed status. uses: actions-ecosystem/action-remove-labels@v1 - if: ${{ env.CONTINUE == 'false' || (env.CONTINUE == 'true' && env.AUDIT_REQUIRED == 'false')}} + if: ${{ env.AUDIT_COMPLETED_ASSIGNED && (env.CONTINUE == 'false' || (env.CONTINUE == 'true' && env.AUDIT_REQUIRED == 'false'))}} with: github_token: ${{ secrets.GIT_ACTIONS_BOT_PAT_CLASSIC }} # we use the token of the lifi-action-bot so the label protection check will pass labels: 'AuditCompleted'