You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Desktop (please complete the following information):
OS: [e.g. iOS] Ubuntu 20.24
Browser [e.g. chrome, safari]: Chrome
Version [e.g. 22]: 95.0.4638.69 (Official Build) (64-bit)
Smartphone (please complete the following information):
Device: [e.g. iPhone6]
OS: [e.g. iOS8.1]
Browser [e.g. stock browser, safari]
Version [e.g. 22]
Additional context
Add any other context about the problem here.
Repository available here
PS: I have added some random messages in the commit, please ignore them
I've noticed the same issue with the double slashes.
@Tom-Whi Yes, I know and added this in Expected behavior section in the original issue ☝️. And this URL is being manipulated by GitHub-scripts, that's why I raised this issue.
url: 'https://api.github.com/repos/flexciton/azure_infrastructure_costs/issues/ <HERE SHOULD BE ISSUE NUMBER?> /comments',
url: 'https://api.github.com/repos/flexciton/azure_infrastructure_costs/issues/ <HERE SHOULD BE ISSUE NUMBER?> /comments',
Yes exactly, because it won't be available on regular push events on the actions.
For now I am using pull_request event to deal with this (it automatically pick the issue from PR)
Can you please let me know the query you used to get the pull request number on Push events ?
I have found a workaround though by getting the pull request number using another query.
Hi,
I paste my workaround code below, hope it helps you or anyone else.
We use it in our pipeline and all is fine.
I am sending this from a mobile so formatting will probably be awkward ;).
If I get a chance I will reformat this on a laptop maybe tomorrow.
Also I have this code in a separate script to avoid polluting the main github workflow file with javascript code.
module.exports=async(github,context)=>{// Get pull requests that are open for current ref.constpullRequests=awaitgithub.rest.pulls.list({owner: context.repo.owner,repo: context.repo.repo,state: 'open',head: `${context.repo.owner}:${context.ref.replace('refs/heads/','')}`})// Set issue number for following calls from context (if on pull request event) or from above variable.constissueNumber=context.issue.number||pullRequests.data[0].number// Retrieve existing bot comments for the PRconst{data: comments}=awaitgithub.rest.issues.listComments({owner: context.repo.owner,repo: context.repo.repo,issue_number: issueNumber,})constbotComment=comments.find(comment=>{returncomment.user.type==='Bot'&&comment.body.includes('Terraform Plan')})// Prepare format of the comment - it has to be de-indented to make markdown work properly.constoutput=`#### Terraform Plan 📖 \`${process.env.TERRAFORM_PLAN_STEP_OUTCOME}\`<hr>*Pusher: @${context.actor}**Action: \`${context.eventName}\`**Workflow: \`${context.workflow}\`**Commit: \`${context.sha}\`*<details><summary>Show Plan</summary>\`\`\`\n${process.env.TERRAFORM_PLAN}\`\`\`</details>`;// If we have a comment, update it, otherwise create a new oneif(botComment){github.rest.issues.updateComment({owner: context.repo.owner,repo: context.repo.repo,comment_id: botComment.id,body: output})}else{github.rest.issues.createComment({issue_number: issueNumber,owner: context.repo.owner,repo: context.repo.repo,body: output})}}
Reacted by Bart Nycz, Sara, Steffen Diswal and George Matyasfalvi
Activity
Tom-Whi commentedon Jul 12, 2022
I've noticed the same issue with the double slashes.
lakshmajee commentedon Jul 13, 2022
@Tom-Whi Yes, I know and added this in Expected behavior section in the original issue ☝️. And this URL is being manipulated by
GitHub-scripts, that's why I raised this issue.Tom-Whi commentedon Jul 13, 2022
Yep. I was agreeing with you.
I also have the same issue using @v5, which produces the same results.
lakshmajee commentedon Jul 13, 2022
@Tom-Whi did you find any solution or trick to solve this kind of error!
Tom-Whi commentedon Jul 13, 2022
Sadly not yet. I'm still trying find a workaround. If I find something I'll post back to this issue.
lakshmajee commentedon Jul 13, 2022
I configured the wrong workflow event.
lakshmajee commentedon Jul 13, 2022
I configured the wrong workflow event.
Tomasz-Kluczkowski commentedon Jul 14, 2022
Ok so this action is basically broken for now?
To me it looks like it
does notinsert issue number when trying to create a comment?url: 'https://api.github.com/repos/flexciton/azure_infrastructure_costs/issues/ <HERE SHOULD BE ISSUE NUMBER?> /comments',lakshmajee commentedon Jul 15, 2022
Yes exactly, because it won't be available on regular
pushevents on the actions.For now I am using
pull_requestevent to deal with this (it automatically pick the issue from PR)Tomasz-Kluczkowski commentedon Jul 15, 2022
lakshmajee commentedon Jul 22, 2022
Working as expected with correct
event(pull_request), which grabs issue number from Pull requestinfa-msheik commentedon Sep 25, 2022
Hi @Tomasz-Kluczkowski
Can you please let me know the query you used to get the pull request number on Push events ?
I have found a workaround though by getting the pull request number using another query.
Tomasz-Kluczkowski commentedon Sep 25, 2022
Hi,
I paste my workaround code below, hope it helps you or anyone else.
We use it in our pipeline and all is fine.
I am sending this from a mobile so formatting will probably be awkward ;).
If I get a chance I will reformat this on a laptop maybe tomorrow.
Also I have this code in a separate script to avoid polluting the main github workflow file with javascript code.