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

ubuntu-workflow comment on pull request fails #2544

Closed
jsoref opened this issue Nov 19, 2024 · 2 comments
Closed

ubuntu-workflow comment on pull request fails #2544

jsoref opened this issue Nov 19, 2024 · 2 comments
Assignees
Labels

Comments

@jsoref
Copy link
Contributor

jsoref commented Nov 19, 2024

Describe the bug

name: ubuntu-workflow
on:
push:
branches:
- master
pull_request:
branches:
- '*'

publish-scan-url:
needs: [ build ]
permissions:
pull-requests: write # to allow creating or updating a comment

- name: Create comment
if: ${{ steps.fc.outputs.comment-id == 0 }}
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
**Timestamp:** ${{ steps.current-time.outputs.formattedTime }}
**Buildscan url for ubuntu-workflow run [${{ github.run_id }}](https://github.com/Flank/flank/actions/runs/${{ github.run_id }})**
${{ needs.build.outputs.build-scan-url }}

https://github.com/Flank/flank/actions/runs/11876421725/job/33212846512#step:1:18

GITHUB_TOKEN Permissions
  Metadata: read
  PullRequests: read

https://github.com/Flank/flank/actions/runs/11876421725/job/33212846512#step:6:52

    data: {
      message: 'Resource not accessible by integration',
      documentation_url: 'https://docs.github.com/rest/issues/comments#create-an-issue-comment',
      status: '403'
    }

To Reproduce

  1. Create Remove macos_workflow #2542
  2. Have someone (@kaibolay) approve the workflow action https://github.com/Flank/flank/actions/runs/11876421725?pr=2542
  3. See that the workflow failed https://github.com/Flank/flank/actions/runs/11876421725/job/33212846512?pr=2542

Expected behavior

Creating PRs from forks should not result in ❌ due to things like this.

Often it's possible to use GITHUB_STEP_SUMMARY instead of comments, this is safe and easy to do.

If comments are needed, it's possible to use some other techniques (historically, I'd use on: pull_request_target, but that requires being very careful with use of actions/checkout and two distinct job phases one that checks out the code under test and one that checks out the trusted code for reporting and has more permissions).

Details (please complete the following information):

Additional context

@jsoref jsoref added the Bug label Nov 19, 2024
@jsoref
Copy link
Contributor Author

jsoref commented Nov 19, 2024

When someone looks at this workflow, they should also address https://github.com/Flank/flank/actions/runs/11876576418#summary-33215677929

Deprecation warnings

This job uses deprecated functionality from the gradle/gradle-build-action action. Follow the links for upgrade details.

@Lyokone
Copy link
Contributor

Lyokone commented Nov 21, 2024

Thanks, looking into this :)

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

No branches or pull requests

4 participants