vsoch / pull-request-action

open a pull request when a branch is pushed or updated
https://github.com/marketplace/actions/pull-request-action
MIT License
174 stars 62 forks source link

fix: construct ASSIGNEES_URL to the correct url #104

Closed HasanKhatib closed 4 months ago

HasanKhatib commented 4 months ago

The issue: The action fails to assign assignees to the created PR**

Logs sample:

START: Running Pull Request on Branch Update Action!
Found ${GITHUB_EVENT_PATH} at /github/workflow/event.json
Branch prefix is 
No branch prefix is set, all branches will be used.
Pull requests will go to main
PULL_REQUEST_DRAFT set to a value: created PRs will be draft PRs.
No preference for maintainer being able to modify: default is true.
PULL_REQUEST_ASSIGNEES is set, HasanKhatib
.
.
github response: 'assignees_url': '[https://api.github.com/repos/ingka-group-digital/resolutions/assignees{/user}](https://api.github.com/repos/ingka-group-digital/resolutions/assignees%7B/user%7D)'

The fix:

This has been fixed in the add_assignees function.

vsoch commented 4 months ago

Can you clarify how this is different? The current implementation already has the repo url, but it's represented in the issue URL.

ISSUE_URL = "%s/issues" % REPO_URL

Can you please show me a before and after to clarify?

HasanKhatib commented 4 months ago

Before: The incorrect URL was %s/%s/assignees, which incorrectly concatenates the issue URL and the issue number directly without the /issues/ prefix, leading to an invalid endpoint.

After: The corrected URL is %s/issues/%s/assignees, ensuring the correct endpoint /issues/{issue_number}/assignees is used for adding assignees to the pull request.

HasanKhatib commented 4 months ago

Argh! I see now.

I will close the PR and create an issue instead, as the issue is still there. It reads the assignees and show it in this log message PULL_REQUEST_ASSIGNEES is set, HasanKhatib , but then returns assignees': [],

HasanKhatib commented 4 months ago

The fix is insufficient, an issue is created for the bug #105