Skip to content

Commit

Permalink
Fix(GitHub Actions): Rebase fails and falls back to merge
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Aug 14, 2023
1 parent ab31fa7 commit 21056bc
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions packages/github-actions/src/sync-dev-branches.js
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)
}
}

0 comments on commit 21056bc

Please sign in to comment.