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

build(gha): Fix js lint job for forked repos #21893

Merged
merged 3 commits into from
Nov 11, 2020

Conversation

billyvg
Copy link
Member

@billyvg billyvg commented Nov 10, 2020

This fixes the js lint job for forked repos, otherwise it would attempt to check out the forked branch from getsentry repo. We can't run the eslint + fix on forks, so create a new step for forks.

@@ -19,6 +19,8 @@ jobs:
# because we want to lint + fix + commit, we need to checkout the HEAD sha (otherwise
# it checks out the merge commit and we will not be able to commit to it)
ref: ${{ github.event.pull_request.head.ref || 'master' }}
# We need the repo here so that this works for forks
repo: ${{ github.event.pull_request.head.repo.full_name }}
Copy link
Member

Choose a reason for hiding this comment

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

Wait, don't we need pull_request_target à la #21600 as well?

Copy link
Member Author

@billyvg billyvg Nov 10, 2020

Choose a reason for hiding this comment

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

We don't because there are no secrets (this doesn't include github_token since it will use the token from the forked repo) that are used, and no write access to getsentry/sentry repo is needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

You can see it working here #21906

Copy link
Member Author

@billyvg billyvg Nov 10, 2020

Choose a reason for hiding this comment

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

@joshuarli Updated to have a specific task for forks as the action doesn't have access to write to the fork :/

@@ -85,8 +92,7 @@ jobs:
git push origin

- name: tsc
if: steps.changes.outputs.frontend == 'true'
continue-on-error: true
Copy link
Member Author

Choose a reason for hiding this comment

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

This is not what we want (it means if tsc fails, it moves on to next step without failing job).

This fixes the js lint job for forked repos, otherwise it would attempt to check out the forked branch from getsentry repo.
@billyvg billyvg merged commit da71c27 into master Nov 11, 2020
@billyvg billyvg deleted the build/gha/fix-js-lint-for-forks branch November 11, 2020 19:04
@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants