Merge branch 'main' into invoketemplatewf #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Perform Precommit Steps | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
determine-branch: | |
runs-on: ubuntu-latest | |
outputs: | |
branch_name: ${{ steps.get_branch.outputs.branch_name }} | |
steps: | |
- name: Get Branch Name | |
id: get_branch | |
run: | | |
if [ "${{ github.event_name }}" == "push" ]; then | |
branch_name=${GITHUB_REF#refs/heads/} | |
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT | |
elif [ "${{ github.event_name }}" == "pull_request" ]; then | |
echo "branch_name=${{ github.head_ref }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Print Final Branch Name | |
run: | | |
echo "Branch Name: ${{ steps.get_branch.outputs.branch_name }}" | |
get-short-sha: | |
runs-on: ubuntu-latest | |
outputs: | |
short_sha: ${{ steps.get_sha.outputs.short_sha }} | |
steps: | |
- name: Show Short Git SHA | |
id: get_sha | |
run: | | |
if [ "${{ github.event_name }}" == "push" ]; then | |
echo "short_sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT | |
elif [ "${{ github.event_name }}" == "pull_request" ]; then | |
echo "short_sha=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT | |
else | |
echo "short_sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT | |
fi | |
- name: Print Short Git SHA | |
run: | | |
echo "Git SHA: ${{ steps.get_sha.outputs.short_sha }}" | |
build: | |
strategy: | |
matrix: | |
service_name: ["hw-ui-service", "hw-ui-service2"] | |
needs: [get-short-sha, determine-branch] | |
uses: thunderbirdgit/gh-actions-wf/.github/workflows/nodejs-build.yml@main | |
with: | |
service_name: ${{matrix.service_name}} | |
short_sha: ${{ needs.get-short-sha.outputs.short_sha }} | |
branch_name: ${{ needs.determine-branch.outputs.branch_name }} |