-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix(GitHub Actions): Rebase fails and falls back to merge
- Loading branch information
Showing
1 changed file
with
14 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
const core = require('@actions/core') | ||
const checkBranchExists = require('./check-branch-exist') | ||
const rebase = require('./rebase') | ||
const merge = require('./merge') | ||
|
||
module.exports = async function syncDevBranches() { | ||
try { | ||
const currentBranchName = process.env.GITHUB_REF_NAME | ||
const targetBranchName = `dev/${currentBranchName}` | ||
if (await checkBranchExists(targetBranchName)) { | ||
const currentBranchName = process.env.GITHUB_REF_NAME | ||
const targetBranchName = `dev/${currentBranchName}` | ||
if (await checkBranchExists(targetBranchName)) { | ||
try { | ||
await rebase(targetBranchName) | ||
} catch (error) { | ||
console.error('Rebase failed, trying merge') | ||
console.error(error) | ||
try { | ||
await merge(targetBranchName) | ||
} catch (error) { | ||
core.setOutput('error', error.message) | ||
core.setFailed(error.message) | ||
} | ||
} | ||
} catch (error) { | ||
core.setOutput('error', error.message) | ||
core.setFailed(error.message) | ||
} | ||
} |