-
Notifications
You must be signed in to change notification settings - Fork 25
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
[feature request] move linked issues together with the pull request #50
Comments
Your guess is correct. The issue ID is not the same as the pull request ID. You can take a look at the workflow file that manages this repository: |
So is there any way we could move an issue like this? |
I don't know what the pull_request context contains in terms of information, but maybe it is possible to get the linked issue via that context. |
They're linked in URLs, but I don't think they're in the response itself, so you'd have to do another API call. https://docs.github.com/en/rest/pulls/pulls#list-pull-requests |
Thanks for investigating the API. This basically allows us to scrape the attached issues from the PR. I'm not sure if this should be covered in this automation, but it could be an interesting feature. If you want, I can suggest a solution that does not require changing the automation. Otherwise, it will take some time because GitHub has changed the project API, forcing me to basically rewrite some things (v2). After this rewrite is done, I could start implementing this functionality. |
Either is good for me :) |
@FortitudeIT I invested some time in the past day's, but couldn't fight a reliable solution so far. Going to investigate it further, unless you found a solution. |
@leonsteinhaeuser no solution found yet? Having the same issue. There has to be a way to move issues and not only pull requests right? |
@anrico-oltmanns I have already invested some time to find a solution to this problem. So far I have not had any luck. The problem is that the links I want are not included in the event response I received from the server (ci-workflow). The only solution I have left is to create more API requests and hope that the response will contain the necessary information. When I have some time, I will take another look and implement this feature. |
Thank you. I Would highly appreciate if you could comment on this discussion again and tag me when found a solution for that problem. |
Status update: The following two files contain the response that the GitHub server sends when I request the value for a particular pull request. The first one contains the link to the issue in the body field (plain text), the second one does not contain the information at all. pr_linked_with_comment.json.log I will investigate this further. |
@leonsteinhaeuser I am really interested in this automation also, ie. I want my issues to be moved into I found this action: https://github.com/1natsu172/github-action-auto-move-related-issue |
Hello everyone, This functionality would allow me to simply select the linked issues that would be closed by the desired pull request. A list of keywords for closing can be found here. In the next few days I will create a first version that we can test to see how it works. Example GraphQL code: local REPO=$2
local OWNER=$3
gh api graphql -f query='
query($owner: String!, $repo: String!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: 21) {
id
closingIssuesReferences(first: 100) {
nodes {
id
number
title
}
totalCount
}
}
}
}' -f owner=$OWNER -f repo=$REPO Response: {
"data": {
"repository": {
"pullRequest": {
"id": "PR_kwDOGWypss5KPRmJ",
"closingIssuesReferences": {
"nodes": [
{
"id": "I_kwDOGWypss5exRM8",
"number": 28,
"title": "[BUG]: 1"
}
],
"totalCount": 1
}
}
}
}
} |
Can someone please verify that the new behavior works as you would expect? You can test this by defining the workflow as follows: pr_closed:
name: pr_closed
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'closed'
env:
done: "Done"
steps:
- name: Move PR to ${{ env.done }}
uses: leonsteinhaeuser/project-beta-automations@feat/move-related-issues
with:
gh_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
user: sample-user
# organization: sample-org
project_id: 1
resource_node_id: ${{ github.event.pull_request.node_id }}
status_value: ${{ env.done }}
move_related_issues: true Once you specify one of the GitHub link options, the issue should be moved along with the pull request. |
Hello @leonsteinhaeuser I confirm that it works! As an example, I put my PR changes here: https://github.com/Oztechan/CCC/pull/2099/files I was able to move related issue to
Last one is important, we should not invoke it only when is closed, but we need to check if it is merged or not. I check the documentation and found best way to do it is:
|
@mustafaozhan thanks for the confirmation. I have merged the pull request and created a new release https://github.com/leonsteinhaeuser/project-beta-automations/releases/tag/v2.1.0 |
Describe the bug
I am trying to move an issue to "In review" on the project board, but it's not moving. My guess is that it's because the PR isn't the same as the issue id?
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The issue is moved to the "In review" lane.
The text was updated successfully, but these errors were encountered: