Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions .github/workflows/build_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,33 @@ jobs:
BuildHomeBlocksDeps:
runs-on: ${{ inputs.platform }}
steps:
- name: Resolve checkout ref
id: resolve-ref
shell: bash
run: |
requested_ref="${{ inputs.branch }}"
fallback_ref="${{ github.ref }}"
repo_url="${{ github.server_url }}/${{ github.repository }}"

if [[ -z "${requested_ref}" ]]; then
echo "::warning::No branch/ref was provided; falling back to '${fallback_ref}'."
checkout_ref="${fallback_ref}"
elif [[ "${requested_ref}" =~ ^refs/ ]] && git check-ref-format "${requested_ref}"; then
checkout_ref="${requested_ref}"
elif git check-ref-format "refs/heads/${requested_ref}" && \
git ls-remote --exit-code --heads "${repo_url}" "${requested_ref}" >/dev/null 2>&1; then
checkout_ref="${requested_ref}"
else
echo "::warning::Requested branch/ref '${requested_ref}' is invalid or was not found in ${{ github.repository }}; falling back to '${fallback_ref}'."
checkout_ref="${fallback_ref}"
fi

echo "checkout_ref=${checkout_ref}" >> "${GITHUB_OUTPUT}"

- name: Retrieve Code
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
ref: ${{ steps.resolve-ref.outputs.checkout_ref }}
if: ${{ inputs.testing == 'True' }}

- name: Check Code Formatting
Expand Down Expand Up @@ -132,7 +155,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: eBay/HomeBlocks
ref: ${{ inputs.branch }}
ref: ${{ steps.resolve-ref.outputs.checkout_ref }}
if: ${{ inputs.testing == 'False' }}

- name: Setup Conan
Expand Down