Skip to content

Commit 4b329ae

Browse files
GitHub token (#44)
2 parents 3c3cb1e + b680dfd commit 4b329ae

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

.ci/install.bash

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ do
1717
-i=* | --image=* )
1818
IMAGE_NAME="${i#*=}" ;;
1919

20+
--gh-token=* )
21+
GH_TOKEN="${i#*=}" ;;
22+
2023
--ssh )
2124
USE_SSH=true ;;
2225

@@ -63,10 +66,17 @@ then
6366
BRANCH_TAG=${MASTER_TAG}
6467
fi
6568

66-
if [ -f ~/.ssh/known_hosts ]
69+
DOCKER_ARGS=()
70+
71+
if [[ -f ~/.ssh/known_hosts ]]
6772
then
6873
MERGE_KNOWN_HOSTS="true"
69-
DOCKER_MOUNT_KNOWN_HOSTS_ARGS="--mount type=bind,source=${HOME}/.ssh/known_hosts,target=/tmp/known_hosts_extra"
74+
DOCKER_ARGS+=("--mount" "type=bind,source=${HOME}/.ssh/known_hosts,target=/tmp/known_hosts_extra")
75+
fi
76+
77+
if [[ -n "${GH_TOKEN}" ]]
78+
then
79+
DOCKER_ARGS+=("-e" "GITHUB_TOKEN=${GH_TOKEN}")
7080
fi
7181

7282
# Docker container can show a header on start-up. We don't want to capture it
@@ -83,7 +93,7 @@ mkdir -p "$HOME"/.cache/pip
8393

8494
# Run the docker image along with setting new environment variables
8595
# shellcheck disable=SC2086
86-
docker run --detach --interactive --tty -e CI="true" -e BRANCH="${BRANCH}" --name tue-env --mount type=bind,source=${HOME}/.ccache,target=${DOCKER_HOME}/.ccache --mount type=bind,source=$HOME/.cache/pip,target=$DOCKER_HOME/.cache/pip ${DOCKER_MOUNT_KNOWN_HOSTS_ARGS} "${IMAGE_NAME}:${BRANCH_TAG}"
96+
docker run --detach --interactive --tty -e CI="true" -e BRANCH="${BRANCH}" --name tue-env --mount type=bind,source=${HOME}/.ccache,target=${DOCKER_HOME}/.ccache --mount type=bind,source=${HOME}/.cache/pip,target=${DOCKER_HOME}/.cache/pip "${DOCKER_ARGS[@]}" "${IMAGE_NAME}:${BRANCH_TAG}"
8797

8898
# Own the ~/.ccache folder for permissions
8999
docker exec -t tue-env bash -c "sudo chown 1000:1000 -R ~/.ccache"

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF}}
4545
mkdir -p ${HOME}/.ssh
4646
ssh-keyscan -t rsa -H "github.com" 2>&1 | tee -a "${HOME}"/.ssh/known_hosts
47-
.ci/install.bash --branch=${BRANCH} --sl=ed --sl=geolib2 --sl=rgbd # (In)direct deps of ed_object_models, but we don't need to build it
47+
.ci/install.bash --branch=${BRANCH} --gh-token="${{ github.token }}" --sl=ed --sl=geolib2 --sl=rgbd # (In)direct deps of ed_object_models, but we don't need to build it
4848
- name: Script
4949
run: .ci/script.bash
5050
- name: Before Deploy

0 commit comments

Comments
 (0)