-
Notifications
You must be signed in to change notification settings - Fork 39
ci: run build-test-push on all PRs, not just same-repo #39
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ jobs: | |
| - uses: pre-commit/action@v1.0.1 | ||
|
|
||
| build-test-push: | ||
| if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) | ||
| if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| needs: pre-commit | ||
| permissions: | ||
|
|
@@ -98,8 +98,9 @@ jobs: | |
| REGISTRY_USERNAME: ${{ env.DOCKERHUB_LOGIN }} | ||
| run: ./hooks/push | ||
| - name: Push Docker Image to GitHub Registry | ||
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | ||
| env: | ||
| REGISTRY_HOST: ghcr.io | ||
| REGISTRY_TOKEN: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} | ||
| REGISTRY_USERNAME: ${{ secrets.BOT_LOGIN || github.repository_owner }} | ||
| REGISTRY_TOKEN: ${{ secrets.BOT_LOGIN && secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} | ||
| REGISTRY_USERNAME: ${{ secrets.BOT_TOKEN && secrets.BOT_LOGIN || github.actor }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may be mistaken, but I believe using |
||
| run: ./hooks/push | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize for the oversight on testing and pushing test pr images in #37
However, I do not think this step should be skipped entirely for PRs from forked repos. After all, If BOT_LOGIN and BOT_TOKEN are configured there should be no problems pushing.
To do this, we can either read these BOT credentials into env and set up a check for them when the event name is a PR like
Or we can just assume that a repo accepting PRs from forks (really only this one) will always have BOT_LOGIN and BOT_TOKEN configured and will never fall back to GITHUB_TOKEN