-
Notifications
You must be signed in to change notification settings - Fork 0
ci: run docker builds from PRs #8
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Build docker image | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| push: | ||
| description: Indicates if the docker image has to be pushed | ||
| type: boolean | ||
| default: false | ||
| outputs: | ||
| image-tag: | ||
| description: Image tag used | ||
| value: ${{ github.event.pull_request.head.sha || github.sha }} | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Docker Build 🐋 | ||
| runs-on: x1-core | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Docker build | ||
| uses: cloudbeds/composite-actions/docker/build-push/remote@v2 | ||
| with: | ||
| push: ${{ inputs.push }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name: Pull Request | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| # Cancel existing workflows running for this PR | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| docker-build: | ||
| name: Docker Build | ||
| uses: ./.github/workflows/docker-build.yaml | ||
| secrets: inherit | ||
| with: | ||
| push: false | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 4 months ago
To fix this problem, we should introduce a
permissionsblock that explicitly scopes the GITHUB_TOKEN permissions to the minimum needed for the job(s). Since we don't see any evidence from this code alone that write permissions or extra scopes are required, the best default iscontents: read, which is commonly the safest minimum. You can add thepermissions:key to the root (top-level) of the workflow so that it applies to all jobs unless overridden, or to the individual job(s); the simplest approach is at the top level, beneathname:and aboveon:. This change only involves inserting a few lines at the top of.github/workflows/pull-request.yaml.