-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the error messages #415
Comments
PS: It is probably of how am using Could it be possible to have labels that dont require a regex matchgroup but rather only serve as a tag to trigger for all target_branches? |
@ggwpez It looks like your workflow is trying to backport the changes a second time. The merged PR's base to backport is the same as the selected target branch. This may lead to conflicts during cherry-picking, which explains why you'd see this error. That's a bug, as backport-action could always exclude this unique case. There's no reason to port changes that were just merged to a branch again to that same branch. To verify that this happened, I'd be interested to see the workflow run logs, particularly the lines regarding:
While we should eventually resolve that as a separate bug, you could work around this by excluding PRs that directly target your target branch. Something like: # Only backport to my_target_branch, if PR did not just merge something to it
if: >
github.event.pull_request.merged &&
github.event.pull_request.base.ref != 'my_target_branch'
steps:
- uses: actions/checkout@v4
- uses: korthout/backport-action@v3
with:
target_branches: my_target_branch
You could also try this. You can use a similar condition checking for specific labels. It may be useful to split up the different usages into separate workflows then:
Hope it helps, and let me know if you run into issues. Feel free to open a bug if you encounter new issues. |
Thanks for taking a look, your workaround with excluding the Details
For future readers, this is the workflow that am currently using: Details
name: Backport into stable
on:
pull_request_target:
types: [ closed, labeled ]
issue_comment:
types: [ created ]
permissions:
contents: write # so it can comment
pull-requests: write # so it can create pull requests
jobs:
backport:
name: Backport pull request
runs-on: ubuntu-latest
# Excluding CI action user id `97796249`:
if: >
( !startsWith(github.event.pull_request.base.ref, 'stable') ) &&
((
github.event_name == 'pull_request_target' &&
github.event.pull_request.merged &&
contains(github.event.pull_request.labels.*.name, 'A4-needs-backport')
) || (
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.user.id != 97796249 &&
(
startsWith(github.event.comment.body, '/backport') ||
contains(toJson(github.event.comment.body), '\n/backport')
)
))
steps:
- uses: actions/checkout@v4
- name: Create backport pull requests
uses: korthout/backport-action@v3
id: backport
with:
target_branches: stable2407 stable2410
merge_commits: skip
github_token: ${{ secrets.GITHUB_TOKEN }}
pull_description: |
Backport #${pull_number} into `${target_branch}` (cc @${pull_author}).
<!--
# To be used by other automation, do not modify:
original-pr-number: #${pull_number}
-->
pull_title: |
[${target_branch}] Backport #${pull_number}
- if: ${{ steps.backport.outputs.created_pull_numbers != '' }}
uses: actions/github-script@v7
with:
script: |
const pullNumbers = '${{ steps.backport.outputs.created_pull_numbers }}'.split(' ');
for (const pullNumber of pullNumbers) {
await github.rest.issues.addLabels({
issue_number: parseInt(pullNumber),
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['A3-backport']
});
console.log(`Added A3-backport label to PR #${pullNumber}`);
} |
Is your feature request related to a problem? Please describe.
Most comments by the action for errors are unclear, unhelpful, and appear to come from nowhere.
Example no permission to push to repo:
Describe the solution you'd like
Error messages should be clear about what was attempted, what went wrong, and what can be done to recover. For example:
Describe alternatives you've considered
..
Additional context
Some other example errors:
Not permitted to create pull request:
Unable to cherry-pick
This error is clear about what happened, what went wrong, and how to recover. However, it still appears to come out of nowhere. A link to the workflow run would help.
The text was updated successfully, but these errors were encountered: