Merge pull request #903 from peter-evans/failure-mode-test

test: add test for detached head failure mode
This commit is contained in:
Peter Evans 2021-08-13 11:47:40 +09:00 committed by GitHub
commit 093c191148
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7557 additions and 6 deletions

View file

@ -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')
})
})

View file

@ -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

7539
package-lock.json generated

File diff suppressed because it is too large Load diff