Skip to content

Commit

Permalink
gh-actions/build-debian: Install git dependency only if GITHUB_TOKEN …
Browse files Browse the repository at this point in the history
…is defined

It's the only reason why we need it so far, so if a project really
requires it, it should add it to the extra source build dependencies
  • Loading branch information
3v1n0 committed Dec 18, 2024
1 parent 18d7e45 commit 2632841
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gh-actions/common/build-debian/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inputs:
description: A list of extra build dependencies required during source build.
required: false
# FIXME: this should default to '', but we don't want to break job depending on us for now
default: 'ca-certificates git'
default: 'ca-certificates'
extra-source-build-script:
description: |
A script to run to prepare the source build machine.
Expand Down Expand Up @@ -140,9 +140,17 @@ runs:
echo "::group::Install build dependencies"
apt build-dep .
GITHUB_TOKEN="${{ inputs.token }}"
if [ -n "${{ inputs.extra-source-build-deps }}" ]; then
# Install extra packages for build-deps, to allow downloading vendored sources
deps=(${{ inputs.extra-source-build-deps }})
if [ -n "${GITHUB_TOKEN}" ]; then
deps+=(git)
fi
apt install ${deps[@]}
fi
echo "::endgroup::"
Expand All @@ -151,7 +159,6 @@ runs:
git config --system --add safe.directory "${{ github.workspace }}"
fi
GITHUB_TOKEN="${{ inputs.token }}"
if [ -n "${GITHUB_TOKEN}" ]; then
git config --system url."https://api:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
fi
Expand Down

0 comments on commit 2632841

Please sign in to comment.