Closed scottmessinger closed 3 years ago
I get the same :( - at least it is not just me.
my config:
- name: Sync staging branch
uses: devmasx/merge-branch@v1.3.0
with:
type: now
target_branch: staging
github_token: ${{ secrets.GITHUB_TOKEN }}
I got same error too.
I debugged it. The error was the variable of @head_to_merge
is empty.
I set from branch
in with.head_to_merge
, I succeeded my actions.
(NOTE: I got 500 error when I set in from_branch
)
see https://github.com/devmasx/merge-branch/blob/master/lib/index.rb#L6
@Yuji-Kuroko is right, my setup was like:
steps:
- uses: actions/checkout@v2
- name: Merge test -> target
uses: devmasx/merge-branch@v1.3.0
with:
type: now
from_branch: test
target_branch: target
github_token: ${{ secrets.TOKEN }}
and I was getting the 500 error but after changing it to:
steps:
- uses: actions/checkout@v2
- name: Merge test -> target
uses: devmasx/merge-branch@v1.3.0
with:
type: now
head_to_merge: test
target_branch: target
github_token: ${{ secrets.TOKEN }}
it worked.
This is basically what @Yuji-Kuroko was saying but with a more code-like example, it's just a naming error in either the code or the README.
I got this error when I try to merge current branch
/usr/local/bundle/gems/octokit-4.14.0/lib/octokit/response/raise_error.rb:16:in `on_complete': POST https://api.github.com/repos/tshenin/ngrx-test/merges: 500 - (Octokit::InternalServerError)
from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/response.rb:9:in `block in call'
from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/response.rb:61:in `on_complete'
from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/response.rb:8:in `call'
from /usr/local/bundle/gems/octokit-4.14.0/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection'
from /usr/local/bundle/gems/octokit-4.14.0/lib/octokit/middleware/follow_redirects.rb:61:in `call'
from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/request/retry.rb:130:in `call'
from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/rack_builder.rb:143:in `build_response'
from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/connection.rb:387:in `run_request'
from /usr/local/bundle/gems/faraday-0.17.0/lib/faraday/connection.rb:175:in `post'
from /usr/local/bundle/gems/sawyer-0.8.2/lib/sawyer/agent.rb:94:in `call'
from /usr/local/bundle/gems/octokit-4.14.0/lib/octokit/connection.rb:156:in `request'
from /usr/local/bundle/gems/octokit-4.14.0/lib/octokit/connection.rb:28:in `post'
from /usr/local/bundle/gems/octokit-4.14.0/lib/octokit/client/commits.rb:214:in `merge'
from /action/lib/index.rb:21:in `<main>'
action yaml
name: Automerge release to develop
on:
push:
branches: ["release/v[0-9]+.[0-9]+.[0-9]+"]
jobs:
sync-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Merge relese -> master
uses: devmasx/merge-branch@v1.3.0
with:
type: now
target_branch: master
github_token: ${{ github.token }}
Does anybody know how can I fix it?
@tshenin refs https://github.com/devmasx/merge-branch/blob/master/lib/index.rb#L6
We need to must set head_to_merge
params.
If doesn't set the param, @head_to_merge
will empty.
So, for example
name: Automerge release to develop
on:
push:
branches: ["release/v[0-9]+.[0-9]+.[0-9]+"]
jobs:
sync-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Merge relese -> master
uses: devmasx/merge-branch@v1.3.0
with:
type: now
head_to_merge: ${{ github.ref }}
target_branch: master
github_token: ${{ github.token }}
Sorry, I didn't try this code.
@Yuji-Kuroko it works. Thank you!
@Yuji-Kuroko thanks a lot.
The error is because Github workflow runs the action in a container setting all inputs with an empty string.
Example of Github action run:
/usr/bin/docker run --name aac2aac8510f65848541c3a6145309a3105a04_34da27 --label aac2aa --workdir /github/workspace --rm -e INPUT_TYPE -e INPUT_TARGET_BRANCH -e INPUT_GITHUB_TOKEN -e INPUT_LABEL_NAME -e INPUT_FROM_BRANCH -e INPUT_HEAD_TO_MERGE -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/test-repository/test-repository":"/github/workspace"
Taking this into account as @Yuji-Kuroko said the bug is in the line https://github.com/devmasx/merge-branch/blob/master/lib/index.rb#L6
@head_to_merge = ENV['INPUT_HEAD_TO_MERGE'] || ENV['INPUT_FROM_BRANCH'] || ENV['GITHUB_SHA'] # or brach name
It should be fixed by adding some logic to check empty values or an empty string value.
Pull requests are welcome :smile:
Fixed in v1.3.1 with PR #9
Hi! I'm trying to use this and I'm getting the following error. Any ideas?