Skip to content

Commit

Permalink
Merge pull request #4 from dilee/byog/default-branch-fix
Browse files Browse the repository at this point in the history
Parameterize user repo default branch
  • Loading branch information
chamodshehanka committed Mar 15, 2022
2 parents f22ed38 + 00a5a4c commit ed07ecd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ inputs:
branch:
required: true
description: 'The branch of the user repository which going to push changes'
headBranch:
required: false
description: 'The head branch of the user repository'
default: 'main'
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as core from '@actions/core';
import {GitHubService} from "./github.service.js";
const defaultBranch = "main";

try {
const headUserBranch = core.getInput('headBranch') || "main";
const token = core.getInput('token');
const org = core.getInput('org');
const userRepoName = core.getInput('userRepoName');
Expand All @@ -16,7 +16,7 @@ try {
console.log(`Branch ${branch} does not exist`);
core.setOutput('branchExists', 'false');

githubService.createBranch(branch, defaultBranch).then(res => {
githubService.createBranch(branch, headUserBranch).then(res => {
console.log(`Branch ${branch} created`);
core.setOutput('branchCreated', 'true');
}).catch(e => {
Expand Down

0 comments on commit ed07ecd

Please sign in to comment.