From 287f7443e17d941b57a37414d12662145a9e9d47 Mon Sep 17 00:00:00 2001 From: Silabs-ThieuVu <65759766+Silabs-ThieuVu@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:47:44 +0700 Subject: [PATCH] Update 00-Check_Coding_Convention.yaml --- .../workflows/00-Check_Coding_Convention.yaml | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/00-Check_Coding_Convention.yaml b/.github/workflows/00-Check_Coding_Convention.yaml index 2116adc0..04e419a7 100644 --- a/.github/workflows/00-Check_Coding_Convention.yaml +++ b/.github/workflows/00-Check_Coding_Convention.yaml @@ -24,26 +24,22 @@ jobs: steps: - name: Trigger run: echo "Triggered by ${{github.event_name}} event" - - name: Check Branch Input run: | - 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 - + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + if [ -z "${{ github.event.inputs.branch }}" ]; then + echo "Branch input is required for manual trigger." + exit 1 + fi + fi - name: Checkout - uses: actions/checkout@v4.1.7 - + uses: actions/checkout@v4.1.7 + with: + ref: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.ref }}" + - name: Log Current Branch and Commit + run: | + echo "Current branch: $(git rev-parse --abbrev-ref HEAD)" + echo "Current commit: $(git rev-parse HEAD)" - name: Install python3.11 if: always() run: |