-
Notifications
You must be signed in to change notification settings - Fork 10
Upload action to alert stockplotr of new release #385
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
Conversation
Checklist
|
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Send repository_dispatch to Repository B (stockplotr) | ||
| uses: peter-evans/repository-dispatch@v3 | ||
| with: | ||
| # This token is required to talk to the GitHub API. | ||
| # It must be a PAT stored in Repo A's secrets with 'repo' scope. | ||
| token: ${{ secrets.REPO_B_PAT }} | ||
|
|
||
| # The target repository where the action will run | ||
| repository: 'nmfs-ost/stockplotr' | ||
|
|
||
| # This is the event name that Repo B's workflow will listen for. | ||
| event-type: 'release_trigger' | ||
|
|
||
| # Pass data needed by Repo B in the client-payload | ||
| client-payload: | | ||
| { | ||
| "release_tag": "${{ github.event.release.tag_name }}", | ||
| "repository_a_name": "${{ github.repository }}" | ||
| } |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 months ago
The best way to fix the problem is to set an explicit permissions block in the workflow YAML, limiting the GITHUB_TOKEN to only the access needed for this workflow. Because the workflow mainly sends a repository dispatch (using a PAT—not GITHUB_TOKEN), and does not need to write code, releases, or issues, the minimum permission should be set to contents: read—GitHub’s recommended baseline. The permissions block should be added at the root of the workflow (just after name: or before/on top of jobs:) so it is inherited by all jobs, unless jobs need elevated permissions (which is not the case here).
Edit .github/workflows/release-for-stockplotr-update.yml:
- Insert the following block:
Place it after the
permissions: contents: read
name:at line 4, beforeon:at line 5.
No new imports, variables, or dependencies are needed.
-
Copy modified lines R4-R5
| @@ -1,6 +1,8 @@ | ||
| # This workflow lives in Repository A (the one with the new release) | ||
|
|
||
| name: 1. Dispatch Release to Repo B | ||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| release: |
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Send repository_dispatch to Repository B (stockplotr) | ||
| uses: peter-evans/repository-dispatch@v3 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step
Code Metrics Report
Reported by octocov |
|
@e-perl-NOAA this is the PR that's linked to the other |
What is the feature?
How have you implemented the solution?
Does the PR impact any other area of the project, maybe another repo?
@k-doering-NOAA if you have any thoughts, advice, or could provide help on this, it would be greatly appreciated!