-
Notifications
You must be signed in to change notification settings - Fork 0
🌱 ci: Use centralized reusable workflows from infra repo #7
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
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 |
|---|---|---|
| @@ -1,43 +1,13 @@ | ||
| name: Add Help Wanted, Good First Issue, or Hacktober Fest Labels | ||
| name: Add Help Wanted Labels | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| issues: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| label-on-comment: | ||
| if: github.event.comment.body == '/help-wanted' || github.event.comment.body == '/good-first-issue' || github.event.comment.body == '/hacktober-fest' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Add label based on comment | ||
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea | ||
| with: | ||
| script: | | ||
| const comment = context.payload.comment.body.trim().toLowerCase(); | ||
| const issue_number = context.payload.issue.number; | ||
| const owner = context.repo.owner; | ||
| const repo = context.repo.repo; | ||
|
|
||
| let label = null; | ||
| if (comment === '/help-wanted') { | ||
| label = 'help wanted'; | ||
| } else if (comment === '/good-first-issue') { | ||
| label = 'good first issue'; | ||
| } else if (comment === '/hacktober-fest') { | ||
| label = 'hacktober-fest'; | ||
| } | ||
|
|
||
| if (label) { | ||
| await github.rest.issues.addLabels({ | ||
| owner, | ||
| repo, | ||
| issue_number, | ||
| labels: [label], | ||
| }); | ||
| console.log(`Added label: ${label}`); | ||
| } else { | ||
| console.log('No matching label to apply.'); | ||
| } | ||
| label: | ||
| uses: kubestellar/infra/.github/workflows/reusable-add-help-wanted.yml@main | ||
| secrets: inherit |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| name: "PR Title Verifier" | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, edited, synchronize, reopened] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| verify: | ||
| uses: kubestellar/infra/.github/workflows/reusable-pr-verify-title.yml@main | ||
| secrets: inherit |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||||||||||||||||||||||||||||
| name: OpenSSF Scorecard | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||
| branch_protection_rule: | ||||||||||||||||||||||||||||||||
| schedule: | ||||||||||||||||||||||||||||||||
| - cron: '0 6 * * 1' | ||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||
| branches: [ "main" ] | ||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||
| analysis: | ||||||||||||||||||||||||||||||||
| uses: kubestellar/infra/.github/workflows/reusable-scorecard.yml@main | ||||||||||||||||||||||||||||||||
| secrets: inherit | ||||||||||||||||||||||||||||||||
|
Comment on lines
+13
to
+14
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
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: {}
Copilot AutofixAI 3 months ago Generally, the fix is to add an explicit The best targeted fix without changing existing functionality is to add a root-level permissions:
contents: readbetween the
Suggested changeset
1
.github/workflows/scorecard.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
||||||||||||||||||||||||||||||||
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 3 months ago
In general, the fix is to add an explicit
permissionssection that restricts theGITHUB_TOKENto the minimum necessary scopes. This can be done either at the top (root) of the workflow so it applies to all jobs, or within theverifyjob. Since this workflow only defines one job and calls a reusable workflow, the cleanest fix with minimal functional impact is to add a root-levelpermissionsblock granting only read access to repository contents (a safe baseline for most verification jobs). If the reusable verifier needs more, it can request additional scoped permissions within its own definition.Concretely, in
.github/workflows/pr-verifier.yml, insert apermissions:block between theon:section and thejobs:section. A conservative minimal configuration iscontents: read, which allows the job to read the repository’s code but not write to it or perform privileged operations. No imports or additional methods are required; this is purely a YAML configuration change within the existing workflow file and does not alter the logical flow of the job.