mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
Merge branch 'dev' of https://github.com/JamesIves/github-pages-deploy-action into dev
This commit is contained in:
commit
9508791a92
@ -2,6 +2,7 @@
|
||||
process.env['INPUT_FOLDER'] = 'build'
|
||||
process.env['GITHUB_SHA'] = '123'
|
||||
process.env['INPUT_DEBUG'] = 'debug'
|
||||
process.env['GITHUB_REF_NAME'] = 'test'
|
||||
|
||||
import '../src/main'
|
||||
import {action, TestFlag} from '../src/constants'
|
||||
|
10
src/lib.ts
10
src/lib.ts
@ -23,12 +23,12 @@ export default async function run(
|
||||
info(`
|
||||
GitHub Pages Deploy Action 🚀
|
||||
|
||||
🚀 Getting Started Guide: https://github.com/marketplace/actions/deploy-to-github-pages
|
||||
❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
|
||||
🔧 Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues
|
||||
|
||||
💖 Support: https://github.com/sponsors/JamesIves
|
||||
📣 Maintained by James Ives: https://jamesiv.es
|
||||
💖 Support: https://github.com/sponsors/JamesIves`)
|
||||
|
||||
🚀 Getting Started Guide: https://github.com/JamesIves/github-pages-deploy-action
|
||||
❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
|
||||
🔧 Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues`)
|
||||
|
||||
info('Checking configuration and starting deployment… 🚦')
|
||||
|
||||
|
@ -43,28 +43,39 @@ export async function generateWorktree(
|
||||
action.workspace,
|
||||
action.silent
|
||||
)
|
||||
|
||||
const checkout = new GitCheckout(action.branch)
|
||||
|
||||
if (branchExists) {
|
||||
// There's existing data on the branch to check out
|
||||
checkout.commitish = `origin/${action.branch}`
|
||||
}
|
||||
if (!branchExists || action.singleCommit) {
|
||||
// Create a new history if we don't have the branch, or if we want to reset it
|
||||
|
||||
if (
|
||||
!branchExists ||
|
||||
(action.singleCommit && action.branch !== process.env.GITHUB_REF_NAME)
|
||||
) {
|
||||
/* Create a new history if we don't have the branch, or if we want to reset it.
|
||||
If the ref name is the same as the branch name, do not attempt to create an orphan of it. */
|
||||
checkout.orphan = true
|
||||
}
|
||||
|
||||
await execute(
|
||||
checkout.toString(),
|
||||
`${action.workspace}/${worktreedir}`,
|
||||
action.silent
|
||||
)
|
||||
|
||||
if (!branchExists) {
|
||||
info(`Created the ${action.branch} branch… 🔧`)
|
||||
|
||||
// Our index is in HEAD state, reset
|
||||
await execute(
|
||||
'git reset --hard',
|
||||
`${action.workspace}/${worktreedir}`,
|
||||
action.silent
|
||||
)
|
||||
|
||||
if (!action.singleCommit) {
|
||||
// New history isn't singleCommit, create empty initial commit
|
||||
await execute(
|
||||
|
Loading…
Reference in New Issue
Block a user