diff --git a/.github/workflows/01-Generate_Firmware.yaml b/.github/workflows/01-Generate_Firmware.yaml index 92fedf9f..bd2511b0 100644 --- a/.github/workflows/01-Generate_Firmware.yaml +++ b/.github/workflows/01-Generate_Firmware.yaml @@ -49,16 +49,22 @@ jobs: - name: Check Branch Input run: | - if [ -z "${{ github.event.inputs.branch }}" ]; then - echo "Branch input is required." - exit 1 + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + if [ -z "${{ github.event.inputs.branch }}" ]; then + echo "Branch input is required for manual trigger." + exit 1 + else + echo "Checkout branch ${{ github.event.inputs.branch }}" + fi + else + # Extract branch name from github.ref + BRANCH_NAME="${{ github.ref }}" + BRANCH_NAME="${BRANCH_NAME##*/}" # This removes everything before the last '/' + echo "Checkout branch $BRANCH_NAME" fi - echo "Checkout branch ${{ github.event.inputs.branch }}" - name: Checkout - uses: actions/checkout@v4.1.7 - with: - ref: "${{ github.event.inputs.branch }}" + uses: actions/checkout@v4.1.7 - name: Install Simplicity SDK if: always() @@ -198,17 +204,23 @@ jobs: - name: Check Branch Input run: | - if [ -z "${{ github.event.inputs.branch }}" ]; then - echo "Branch input is required." - exit 1 + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + if [ -z "${{ github.event.inputs.branch }}" ]; then + echo "Branch input is required for manual trigger." + exit 1 + else + echo "Checkout branch ${{ github.event.inputs.branch }}" + fi + else + # Extract branch name from github.ref + BRANCH_NAME="${{ github.ref }}" + BRANCH_NAME="${BRANCH_NAME##*/}" # This removes everything before the last '/' + echo "Checkout branch $BRANCH_NAME" fi - echo "Checkout branch ${{ github.event.inputs.branch }}" - name: Checkout - uses: actions/checkout@v4.1.7 - with: - ref: "${{ github.event.inputs.branch }}" - + uses: actions/checkout@v4.1.7 + - name: Install Simplicity SDK if: always() run: |