Skip to content

Commit

Permalink
Update precommit.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbirdgit authored Aug 28, 2024
1 parent 53ba78a commit d0b1efe
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ env:
service_name: hw-ui-service

jobs:
determine-branch:
runs-on: ubuntu-latest
steps:
- name: Get Branch Name
id: get_branch
run: |
if [ "${{ github.event_name }}" == "push" ]; then
echo "Branch Name: ${{ github.ref }}"
# Extract the branch name
branch_name=${GITHUB_REF#refs/heads/}
echo "Branch Name: $branch_name"
echo "branch_name=$branch_name" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "pull_request" ]; then
echo "Head Branch Name: ${{ github.head_ref }}"
echo "head_branch_name=${{ github.head_ref }}" >> $GITHUB_ENV
fi
- name: Print Final Branch Name
run: |
echo "Branch Name: ${branch_name:-$head_branch_name}"
get-short-sha:
runs-on: ubuntu-latest
outputs:
Expand All @@ -21,10 +42,10 @@ jobs:
run: echo "short_sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV

build:
needs: [get-short-sha]
needs: [get-short-sha, determine-branch]
uses: thunderbirdgit/gh-actions-wf/.github/workflows/nodejs-build.yml@main
with:
#service_name: "${{ env.service_name }}"
service_name: "hw-ui-service"
#short_sha: "${{ needs.get-short-sha.outputs.short_sha }}"
branch_name: "${{ github.head_ref }}"
branch_name: "${{ needs.determine-branch.outputs.branch_name }}"

0 comments on commit d0b1efe

Please sign in to comment.