LasyIsLazy/github-upload-action

Support uploading to a specific branch

Closed this issue · 2 comments

Currently all files are uploaded to the default branch, as that is what the GitHub API uses by default. I want to pass in a parameter indicating the branch name to use for uploading the file.

As a requirement I'd say that the branch already has to exist. Creating it is not necessary for me.

Changes needed

  • Add an optional parameter to the action to specify the branch name
  • Add the extra parameter to the PUT call in upload.js, see documentation

data: {
message: commitMessage,
sha,
content: base64Content
}
}).then(({ data }) => {

I'd be happy to help working on this :-)

I'd be thankful if you can make a PR for this.
Additional, There may be several points to note:

  • What will the GitHub API do if the branch is not existed?
  • Which structure should we use for the extra parameter to the PUT call?

I'd say create the branch if it doesn't exist yet. Currently the upload just fails with a non-descriptive error. Will see if I can add that as well, maybe tomorrow.

See the progress here #5