Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Add 403 error handling to rerun-workflows.yml (#70916)

github-automation-metabaseeea9a750d6a9
diff --git a/.github/workflows/rerun-workflows.yml b/.github/workflows/rerun-workflows.yml
index a2d33dc9111..81fb1663a28 100644
--- a/.github/workflows/rerun-workflows.yml
+++ b/.github/workflows/rerun-workflows.yml
@@ -40,11 +40,19 @@ jobs:
const BRANCH = process.env.BRANCH_NAME;
if (ATTEMPT <= MAX_ATTEMPTS) {
- github.rest.actions.reRunWorkflowFailedJobs({
- owner: context.repo.owner,
- repo: context.repo.repo,
- run_id: ${{ github.event.workflow_run.id }},
- });
+ try {
+ await github.rest.actions.reRunWorkflowFailedJobs({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ run_id: ${{ github.event.workflow_run.id }},
+ });
+ } catch (error) {
+ if (error.status === 403) {
+ console.log(`Skipping re-run: ${error.message}`);
+ } else {
+ throw error;
+ }
+ }
} else if (!BRANCH.includes('backport-')) {
// notify slack of repeated failure
const { WebClient } = require('@slack/web-api');