Skip to content
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

GitHub action failing to add PR comment #797

Open
danielwoodhead opened this issue May 4, 2022 · 14 comments
Open

GitHub action failing to add PR comment #797

danielwoodhead opened this issue May 4, 2022 · 14 comments

Comments

@danielwoodhead
Copy link

I'm getting this error message when using the GitHub action (the typo is genuine):

Deployment Complete :)
Visit your site at: https://ambitious-moss-0285d8b03-4.westeurope.1.azurestaticapps.net/
Unexectedly failed to add GitHub comment.

Example run (see 'Build and Deploy' step)': https://github.com/danielwoodhead/release-strategy/runs/6295807292?check_suite_focus=true
Workflow: https://github.com/danielwoodhead/release-strategy/blob/main/.github/workflows/dev.yml

@oneolddev
Copy link

I'm getting the same message.

It's been a while but there use to be a comment inserted with the hyperlink to the deployed site. I believe the error message is due to the fact that access the build is unable to write this comment.

@blrchen
Copy link

blrchen commented May 19, 2022

Getting same error too. Is there an update on how to fix?

@SIkebe
Copy link

SIkebe commented Jun 8, 2022

This works for me

permissions:
  contents: read
  pull-requests: write

image

@blowsie
Copy link

blowsie commented Feb 10, 2023

This works for me

permissions:
  contents: read
  pull-requests: write

image

I have checked the permissions and I still get this error

@pacharanero
Copy link

@blowsie I think you need to select Read and write permissions in the workflow settings, I think?

That said, adding the pull-requests: write permission fixed this for me, thanks @SIkebe

@pacharanero
Copy link

These permissions section in Actions are relatively new and have broken other Actions I use too. Azure Static web apps need to update the default Action which is created when the Static Web App is configured, so that it includes this permissions section.

It would be good if the documentation would be updated as well to reflect this.

@blowsie
Copy link

blowsie commented Mar 16, 2023

@blowsie I think you need to select Read and write permissions in the workflow settings, I think?

That said, adding the pull-requests: write permission fixed this for me, thanks @SIkebe

I do have that set, but still not working for me.

@blowsie
Copy link

blowsie commented Mar 20, 2023

FWIW, I also tried
permissions: write-all and had no luck here..

GitHub Enterprise Server 3.8.0

image

name: Azure Feature

on:
  pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
      - develop

permissions: write-all

jobs:
...

@blowsie
Copy link

blowsie commented Mar 29, 2023

So the reason for this failing on my project is that the code does not support github enterprise, because api.github.com is hardcoded in the docker image.

StaticSitesClient.Helpers.GithubApiHelper
MicrosoftTeams-image

@blowsie
Copy link

blowsie commented Mar 29, 2023

@vivekjilla sorry to tag you directly, do you know if this project is being maintained and who may be able to addresses these issues?

  • hardcoded api.github.com
  • typo in error message

@vivekjilla
Copy link

@blowsie Aplogies for the delay here, and thanks for tagging me.

Also, thank you for finding the root cause of your issue as well!

I'll check with my team and get these two issues added to our backlog and get them fixed.

@blowsie
Copy link

blowsie commented May 16, 2023

@vivekjilla
I appreciate there are a huge amounts of open issues and things to manage here, but is there any way we can get these changes implemented? They are as clear as day, I would create a PR myself if I could but it's not open source?

@blowsie
Copy link

blowsie commented Aug 23, 2023

@anthonychu @microsoftopensource

Are you able to help at all please

@VANQUOC81
Copy link

@SIkebe. Under workflow permission, I selected the read and write permissions radiobutton. That solved my problem. Thx man.
The below yaml code was not even needed in my case:

permissions:
  contents: read
  pull-requests: write  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants