vsoch / pull-request-action

open a pull request when a branch is pushed or updated

Home Page:https://github.com/marketplace/actions/pull-request-action

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PR body is blank

bencooper222 opened this issue · comments

Currently, body isn't included in the stuff that gets POSTed to the GitHub API. Even if we fix it, I have a similar issue to the last error where only the first word in the body is sent. I think the solution to this issue or #6 is to either use jq (full disclosure: this is based on one google search) in the shell or switch to a more expressive language like JS. Personally, I think the latter would make this more maintainable but jq would probably work

How would jq help? It's meant to parse json output, not post.

I've successfully used python to read in a file and then send with requests, this might be a more reasonable idea so the user doesn't need to think about how to escape the envar. We could change the post to be done in a similar way, would that work?

My impression was jq could help compose json - looks like I was wrong.

I think that would work? I'm not really an expert on shell files but that sounds reasonable.

I won't be able to take a look until tomorrow, but in the meantime could you please share your main.workflow and the output from the log in your GitHub action? I will need it to debug further.

https://github.com/VandyHacks/fisherman/runs/132861567

It's all in that repo. Note that I slightly altered the version of the action that that repo runs: bencooper222@72248aa

All fixed :) See the PR here vsoch/pull-request-action-test#3 and the associated workflow for that repo:

workflow "Create Pull Request" {
  on = "push"
  resolves = "Create New Pull Request"
}

action "Create New Pull Request" {
  uses = "vsoch/pull-request-action@master"
  secrets = [
    "GITHUB_TOKEN"
  ]
  env = {
    PULL_REQUEST_BRANCH = "master"
    PULL_REQUEST_DRAFT = "true"
    PULL_REQUEST_TITLE = "This is the title of the PR"
    PULL_REQUEST_BODY = "This is the body of the PR"
  }
}

The body was missing from the data, and quotes fixed the missing title, etc.

Thanks!