Introduce default_branch

This commit is contained in:
Lars Gohr
2020-09-01 21:03:23 +02:00
parent cc40c79473
commit d8fded1799
4 changed files with 36 additions and 3 deletions

View File

@@ -614,6 +614,21 @@ teardown() {
/usr/local/bin/docker logout"
}
@test "it can change the default branch" {
export GITHUB_REF='refs/heads/trunk'
export INPUT_DEFAULT_BRANCH='trunk'
run /entrypoint.sh
expectStdOutContains "::set-output name=tag::latest"
expectMockCalledContains "/usr/local/bin/docker login -u USERNAME --password-stdin
/usr/local/bin/docker build -t my/repository:latest .
/usr/local/bin/docker push my/repository:latest
/usr/local/bin/docker inspect --format={{index .RepoDigests 0}} my/repository:latest
/usr/local/bin/docker logout"
}
expectStdOutIs() {
local expected=$(echo "${1}" | tr -d '\n')
local got=$(echo "${output}" | tr -d '\n')