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

infra: fix preflight comment for external contributors #3038

Merged
merged 4 commits into from
Aug 14, 2024

Conversation

ST-DDT
Copy link
Member

@ST-DDT ST-DDT commented Aug 5, 2024

This PR fixes the preflight comments for external contributors.

PRs that are created from third party repositories are run with read only permissions, thus the CI run is unable to post the comment to the PR.

There are two solutions to that issue:

  1. Use the pull request target event
  2. Run a secondary CI step with increased permissions

The pull_request_target event based CI pipeline is considered dangerous if it uses the checked out code and since the pipeline actually uses the PRs code in order to determine whether it is complete or not, this is not an option.
So this PR uses the second option and runs an independent CI step using the code from next to run the script to update the comment.

Example

I hope that I tested this sufficiently and this isn't just a flawed test setup.
It would be good, if you could test this by creating a PR with preflight diffs against ST-DDT/faker:next (optimally by using your own forks of faker instead of from the main repo)

@ST-DDT ST-DDT self-assigned this Aug 5, 2024
Copy link

netlify bot commented Aug 5, 2024

Deploy Preview for fakerjs ready!

Name Link
🔨 Latest commit 1103d00
🔍 Latest deploy log https://app.netlify.com/sites/fakerjs/deploys/66bd332e59693f0008913d55
😎 Deploy Preview https://deploy-preview-3038.fakerjs.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ST-DDT ST-DDT closed this Aug 5, 2024
@ST-DDT ST-DDT reopened this Aug 5, 2024
@ST-DDT ST-DDT changed the title Ci/pr preflight external infra(CI): enable preflight comment for external contributors Aug 5, 2024
Copy link

codecov bot commented Aug 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.97%. Comparing base (1e9d65b) to head (1103d00).
Report is 1 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #3038   +/-   ##
=======================================
  Coverage   99.96%   99.97%           
=======================================
  Files        2772     2772           
  Lines      226173   226173           
  Branches      944      942    -2     
=======================================
+ Hits       226095   226108   +13     
+ Misses         78       65   -13     

see 2 files with indirect coverage changes

@ST-DDT ST-DDT added p: 1-normal Nothing urgent c: infra Changes to our infrastructure or project setup labels Aug 5, 2024
@ST-DDT ST-DDT added this to the vAnytime milestone Aug 5, 2024
@ST-DDT ST-DDT marked this pull request as ready for review August 5, 2024 21:19
@ST-DDT ST-DDT requested a review from a team as a code owner August 5, 2024 21:19
@ST-DDT ST-DDT requested a review from a team August 5, 2024 21:19
@Shinigami92
Copy link
Member

as with your other PR, please first adjust the PR title to something matching with the history

@ST-DDT ST-DDT changed the title infra(CI): enable preflight comment for external contributors infra: fix preflight comment for external contributors Aug 7, 2024
@ST-DDT
Copy link
Member Author

ST-DDT commented Aug 7, 2024

as with your other PR, please first adjust the PR title to something matching with the history

Done

Shinigami92
Shinigami92 previously approved these changes Aug 7, 2024
import-brain
import-brain previously approved these changes Aug 8, 2024
Copy link
Member

@xDivisionByZerox xDivisionByZerox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current PR desciption doesn't provide information why the setup did not work previously. I can follow the steps done in the PR, but can't confirm for myself why this fixes the problem. Could you be so kind to give a short explanation in the PR description, please.

.github/workflows/commentCodeGeneration.ts Show resolved Hide resolved
.github/workflows/preflight-comment.yml Show resolved Hide resolved
.github/workflows/preflight-comment.yml Show resolved Hide resolved
@ST-DDT
Copy link
Member Author

ST-DDT commented Aug 9, 2024

The current PR desciption doesn't provide information why the setup did not work previously. I can follow the steps done in the PR, but can't confirm for myself why this fixes the problem. Could you be so kind to give a short explanation in the PR description, please.

Sure, will add it when I'm back.
TLDR: External PRs dont have any permissions (to comment on the PR).

@xDivisionByZerox
Copy link
Member

FYI: I tested this implementation against @ST-DDT's fork and it worked as expected.

@ST-DDT ST-DDT added the needs rebase There is a merge conflict label Aug 12, 2024
@ST-DDT ST-DDT dismissed stale reviews from import-brain and Shinigami92 via 475c3cb August 13, 2024 19:26
@ST-DDT ST-DDT removed the needs rebase There is a merge conflict label Aug 13, 2024
@ST-DDT
Copy link
Member Author

ST-DDT commented Aug 13, 2024

Ready for review

@ST-DDT ST-DDT enabled auto-merge (squash) August 14, 2024 22:44
@ST-DDT ST-DDT merged commit ff808d5 into faker-js:next Aug 14, 2024
21 checks passed
@ST-DDT ST-DDT deleted the ci/pr-preflight-external branch August 14, 2024 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: infra Changes to our infrastructure or project setup p: 1-normal Nothing urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants