Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
if [ -z "${CODEBUILD_RESOLVED_SOURCE_VERSION:-}" ]; then
{
echo "Error: CODEBUILD_RESOLVED_SOURCE_VERSION is not set"
} >&2
exit 1
else
echo "Resolved hash: ${CODEBUILD_RESOLVED_SOURCE_VERSION}"
fi
echo "Creating tmp dirs"
mkdir tmp
cd tmp
echo "Clonning repository"
git clone https://$GITHUB_API_TOKEN:x-oauth-basic@github.com/username/repository-name ./
echo "Resetting to version from build"
git reset "$CODEBUILD_RESOLVED_SOURCE_VERSION"
echo "Moving git dir to build directory"
cd ../
mv tmp/.git ./
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.