Repository: electron/electron
Pull request: ci: fix up branch CI audit workflow

#### Description of Change

<!--
Thank you for your Pull Request. Please provide a description above and review
the requirements below.

Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md
-->

Don't send the Slack message on the workflow itself failing (we've seen it happen due to 5XX errors from GitHub servers or general GHA issues), ignores failures of the workflow itself, fixes some syntax errors which slipped in, and updates the Slack message to only send when run on `main` so we can more easily test this on branches without spamming ourselves

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] PR description included and stakeholders cc'd

#### Release Notes

Notes: none <!-- Please add a one-line description for app developers to read in the release notes, or 'none' if no notes relevant to app developers. Examples and help on special cases: https://github.com/electron/clerk/blob/main/README.md#examples -->


Changed files:
filename: .github/workflows/audit-branch-ci.yml
patch: @@ -17,6 +17,7 @@ jobs:
     steps:
       - run: npm install @actions/cache @electron/fiddle-core
       - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
+        id: audit-errors
         with:
           github-token: ${{ secrets.GITHUB_TOKEN }}
           script: |
@@ -52,6 +53,10 @@ jobs:
 
               // Check for runs which had error annotations
               for (const checkRun of Array.from(latestCheckRuns.values())) {
+                if (checkRun.name === "Audit CI on Branches") {
+                  continue; // Skip the audit workflow itself
+                }
+
                 const annotations = (await github.rest.checks.listAnnotations({
                   owner: "electron",
                   repo: "electron",
@@ -63,8 +68,8 @@ jobs:
                     ({ annotation_level, message }) =>
                       annotation_level === "failure" &&
                       !message.startsWith("Process completed with exit code") &&
-                      !message.startsWith("Response status code does not indicate success"),
-                      !/Unable to make request/.test(message),
+                      !message.startsWith("Response status code does not indicate success") &&
+                      !/Unable to make request/.test(message) &&
                       !/The requested URL returned error/.test(message),
                   )
                 ) {
@@ -96,6 +101,7 @@ jobs:
             }
 
             if (runsWithErrors.length > 0) {
+              core.setOutput('errorsFound', true);
               core.summary.addHeading('⚠️ Runs with Errors');
               core.summary.addTable([
                 [
@@ -130,7 +136,7 @@ jobs:
 
             await core.summary.write();
       - name: Send Slack message if errors
-        if: failure()
+        if: ${{ steps.audit-errors.outputs.errorsFound && github.ref == 'refs/heads/main' }}
         uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
         with:
           payload: |