From 18bab1f15fa10d9f12a3336fd08d90ca572ccf55 Mon Sep 17 00:00:00 2001 From: Erik Hu Date: Mon, 4 Aug 2025 13:19:41 +0000 Subject: [PATCH 1/2] fix typo --- .github/workflows/parent-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/parent-workflow.yml b/.github/workflows/parent-workflow.yml index 914ba9c302..fdcf24e3b8 100644 --- a/.github/workflows/parent-workflow.yml +++ b/.github/workflows/parent-workflow.yml @@ -54,7 +54,7 @@ jobs: workflow-AMALGAMATION-completed_${{ github.sha }} workflow-TRUDAG-EXTENSIONS-completed_${{ github.sha }} workflow-LABELER-completed_${{ github.sha }} - workflow-CIFUZZ-completed_${{ github.event.inputs.PARENT_SHA }} + workflow-CIFUZZ-completed_${{ github.sha }} ) COMPLETED=false From 09f264e0248aa8ae6ebc0ec3bd3d17b01b5109a8 Mon Sep 17 00:00:00 2001 From: Erik Hu Date: Mon, 4 Aug 2025 14:34:37 +0000 Subject: [PATCH 2/2] dynamic workflow triggers --- .github/workflows/parent-workflow.yml | 38 +++++++++------------------ 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/.github/workflows/parent-workflow.yml b/.github/workflows/parent-workflow.yml index fdcf24e3b8..25da73f806 100644 --- a/.github/workflows/parent-workflow.yml +++ b/.github/workflows/parent-workflow.yml @@ -3,7 +3,7 @@ name: Parent Workflow on: [pull_request] permissions: - contents: write + contents: write pages: write pull-requests: write id-token: write @@ -16,31 +16,20 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Trigger "Check Amalgamation" Workflow + - name: Define Workflows to Trigger + id: define-workflows run: | - echo "Triggering Check Amalgamation workflow with branch: ${{ github.head_ref }}" - gh workflow run "Check amalgamation" --ref ${{ github.head_ref }} -F PARENT_SHA=${{ github.sha }} - env: - GH_TOKEN: ${{ secrets.PARENT_WORKFLOW_TRIGGER }} - - - name: Trigger "Test Trudag Extensions" Workflow - run: | - echo "Triggering Test Trudag Extensions workflow with branch: ${{ github.head_ref }}" - gh workflow run "Test Trudag extensions" --ref ${{ github.head_ref }} -F PARENT_SHA=${{ github.sha }} - env: - GH_TOKEN: ${{ secrets.PARENT_WORKFLOW_TRIGGER }} - - - name: Trigger "CIFuzz" Workflow - run: | - echo "Triggering cifuzz workflow with branch: ${{ github.head_ref }}" - gh workflow run "CIFuzz" --ref ${{ github.head_ref }} -F PARENT_SHA=${{ github.sha }} - env: - GH_TOKEN: ${{ secrets.PARENT_WORKFLOW_TRIGGER }} + echo "CHECK_AMALGAMATION=Check amalgamation" >> workflows_list.txt + echo "TEST_TRUDAG_EXTENSIONS=Test Trudag extensions" >> workflows_list.txt + echo "CIFUZZ=CIFuzz" >> workflows_list.txt + echo "PR_LABELER=Pull Request Labeler" >> workflows_list.txt - - name: Trigger "Pull Request Labeler" Workflow + - name: Trigger Workflows Dynamically run: | - echo "Triggering Pull Request Labeler workflow with branch: ${{ github.head_ref }}" - gh workflow run "Pull Request Labeler" --ref ${{ github.head_ref }} -F PARENT_SHA=${{ github.sha }} + while IFS='=' read -r ID WORKFLOW; do + echo "Triggering $WORKFLOW workflow with branch: ${{ github.head_ref }}" + gh workflow run "$WORKFLOW" --ref "${{ github.head_ref }}" -F PARENT_SHA="${{ github.sha }}" + done < workflows_list.txt env: GH_TOKEN: ${{ secrets.PARENT_WORKFLOW_TRIGGER }} @@ -61,19 +50,16 @@ jobs: MAX_RETRIES=60 # Retry up to 60 times (15 mins, with 15s intervals) RETRY_COUNT=0 - # Create a directory for each artifact to prevent name conflicts while [ "$COMPLETED" = "false" ] && [ $RETRY_COUNT -lt $MAX_RETRIES ]; do COMPLETED=true for ARTIFACT in "${REQUIRED_ARTIFACTS[@]}"; do echo "Attempting to download artifact: $ARTIFACT" - # Create a fresh directory for the artifact EXTRACT_DIR="artifacts/$ARTIFACT" rm -rf "$EXTRACT_DIR" # Ensure the directory is clean mkdir -p "$EXTRACT_DIR" - # Download and extract the artifact into the clean directory gh run download --name "$ARTIFACT" --dir "$EXTRACT_DIR" || COMPLETED=false done