-
Notifications
You must be signed in to change notification settings - Fork 26
chore: use a single deploy workflow template #618
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
Changes from all commits
8f28f29
31fdfc0
8efadd7
ccf3aac
6db2039
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 | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,68 @@ | |||||||||||||||||||||||||||||
| name: Test Scripts | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| permissions: | |||||||||||||||||||||||||||||
| contents: read | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||||||||
| paths: | |||||||||||||||||||||||||||||
| - "scripts/**" | |||||||||||||||||||||||||||||
| - "templates/**" | |||||||||||||||||||||||||||||
| - "samples/**/compose.yaml" | |||||||||||||||||||||||||||||
| - "samples/**/compose.yml" | |||||||||||||||||||||||||||||
| push: | |||||||||||||||||||||||||||||
| branches: | |||||||||||||||||||||||||||||
| - main | |||||||||||||||||||||||||||||
| paths: | |||||||||||||||||||||||||||||
| - "scripts/**" | |||||||||||||||||||||||||||||
| - "templates/**" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| test: | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Node.js | |||||||||||||||||||||||||||||
| uses: actions/setup-node@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| node-version: "20" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: npm install | |||||||||||||||||||||||||||||
| working-directory: scripts | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run tests | |||||||||||||||||||||||||||||
| run: npm test | |||||||||||||||||||||||||||||
| working-directory: scripts | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| preview-workflows: | |||||||||||||||||||||||||||||
| if: github.event_name == 'pull_request' | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| fetch-depth: 2 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Node.js | |||||||||||||||||||||||||||||
| uses: actions/setup-node@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| node-version: "20" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: npm install | |||||||||||||||||||||||||||||
| working-directory: scripts | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Get changed samples | |||||||||||||||||||||||||||||
| run: ./scripts/check-modified-samples.sh > modified.txt | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Preview workflows | |||||||||||||||||||||||||||||
| uses: actions/github-script@v7 | |||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||
| DRY_RUN: "true" | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| script: | | |||||||||||||||||||||||||||||
| const script = require('./scripts/template-manager.js') | |||||||||||||||||||||||||||||
| await script({github, context, core}); | |||||||||||||||||||||||||||||
|
Comment on lines
+41
to
+68
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium test
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 1 day ago In general, the problem is fixed by adding an explicit The best minimal fix is to add a workflow-level Concretely, in permissions:
contents: readNo other changes are required.
Suggested changeset
1
.github/workflows/test-scripts.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Refresh and try again.
|
|||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Update Template Workflows | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "templates/deploy.yaml" | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| update_workflows: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
|
|
||
| - name: Install dependencies | ||
| run: npm install | ||
| working-directory: scripts | ||
|
|
||
| - name: Update Template Workflows | ||
| uses: actions/github-script@v7 | ||
| env: | ||
| PUSH_TOKEN: ${{ secrets.TEMPLATES_MANAGER_TOKEN }} | ||
| with: | ||
| github-token: ${{ secrets.TEMPLATES_MANAGER_TOKEN }} | ||
| script: | | ||
| const script = require('./scripts/update-template-workflows.js') | ||
| await script({github, context, core}); |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium test
Copilot Autofix
AI about 8 hours ago
In general, the fix is to explicitly set a minimal
permissionsblock for the workflow or for individual jobs, so that theGITHUB_TOKENhas only the scopes required. Here, both jobs only need to read repository contents (for checkout and script execution) and to read basic PR metadata (already available withcontents: read), with no visible need for write access. The best fix is to add a root‑levelpermissionsblock (applies to all jobs) directly under thename:oron:section withcontents: read. If in your environment thetemplate-manager.jsever needs to write to PRs or issues, you could later extend this explicitly (e.g.,pull-requests: write), but that is not evident from the provided snippet.Concretely, in
.github/workflows/test-scripts.yml, add:near the top of the file (e.g., after
name: Test Scriptsand beforeon:). No additional imports, methods, or dependencies are required sincepermissionsis a native workflow configuration key.