Skip to content

Commit 093c191

Browse files
authored
Merge pull request #903 from peter-evans/failure-mode-test
test: add test for detached head failure mode
2 parents b90b9c1 + 00cb0ab commit 093c191

File tree

3 files changed

+7557
-6
lines changed

3 files changed

+7557
-6
lines changed

__test__/create-or-update-branch.int.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,4 +1740,26 @@ describe('create-or-update-branch tests', () => {
17401740
])
17411741
).toBeTruthy()
17421742
})
1743+
1744+
// This failure mode is a limitation of the action. Controlling your own commits cannot be used in detached HEAD state.
1745+
// https://github.com/peter-evans/create-pull-request/issues/902
1746+
it('tests failure to create with commits on the working base (during the workflow) in detached HEAD state (WBNR)', async () => {
1747+
// Checkout the HEAD commit SHA
1748+
const headSha = await git.revParse('HEAD')
1749+
await git.checkout(headSha)
1750+
1751+
// Create commits on the working base
1752+
const commits = await createCommits(git)
1753+
const commitMessage = uuidv4()
1754+
const result = await createOrUpdateBranch(
1755+
git,
1756+
commitMessage,
1757+
BASE,
1758+
BRANCH,
1759+
REMOTE_NAME,
1760+
false
1761+
)
1762+
// The action cannot successfully create the branch
1763+
expect(result.action).toEqual('none')
1764+
})
17431765
})

__test__/integration-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ COPY __test__/entrypoint.sh /entrypoint.sh
1616
ENTRYPOINT ["/entrypoint.sh"]
1717
EOF
1818

19-
docker build -t $IMAGE .
19+
docker build --no-cache -t $IMAGE .
2020
rm Dockerfile
2121
fi
2222

0 commit comments

Comments
 (0)