Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add test for detached head failure mode #903

Merged
merged 2 commits into from
Aug 13, 2021
Merged
Show file tree
Hide file tree
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
22 changes: 22 additions & 0 deletions __test__/create-or-update-branch.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1740,4 +1740,26 @@ describe('create-or-update-branch tests', () => {
])
).toBeTruthy()
})

// This failure mode is a limitation of the action. Controlling your own commits cannot be used in detached HEAD state.
// https://github.com/peter-evans/create-pull-request/issues/902
it('tests failure to create with commits on the working base (during the workflow) in detached HEAD state (WBNR)', async () => {
// Checkout the HEAD commit SHA
const headSha = await git.revParse('HEAD')
await git.checkout(headSha)

// Create commits on the working base
const commits = await createCommits(git)
const commitMessage = uuidv4()
const result = await createOrUpdateBranch(
git,
commitMessage,
BASE,
BRANCH,
REMOTE_NAME,
false
)
// The action cannot successfully create the branch
expect(result.action).toEqual('none')
})
})
2 changes: 1 addition & 1 deletion __test__/integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ COPY __test__/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EOF

docker build -t $IMAGE .
docker build --no-cache -t $IMAGE .
rm Dockerfile
fi

Expand Down
Loading