-
Notifications
You must be signed in to change notification settings - Fork 123
chore(CI): add slack notifications #2179
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 | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||||||||||||||||||||||||||||
| name: Issue Created Notification | ||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||
| issues: | ||||||||||||||||||||||||||||||||
| types: [opened, reopened] | ||||||||||||||||||||||||||||||||
| issue_comment: | ||||||||||||||||||||||||||||||||
| types: [created] | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||
| notify-issue: | ||||||||||||||||||||||||||||||||
| if: github.event_name == 'issues' | ||||||||||||||||||||||||||||||||
| uses: aws/aws-cryptographic-material-providers-library/.github/workflows/slack-notification.yml@main | ||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||
| message: "New github issue `${{ github.event.issue.title }}`. Link: ${{ github.event.issue.html_url }}" | ||||||||||||||||||||||||||||||||
| secrets: | ||||||||||||||||||||||||||||||||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_GHI }} | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| notify-comment: | ||||||||||||||||||||||||||||||||
| if: github.event_name == 'issue_comment' && !github.event.issue.pull_request | ||||||||||||||||||||||||||||||||
| uses: aws/aws-cryptographic-material-providers-library/.github/workflows/slack-notification.yml@main | ||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||
| message: "New comment on issue `${{ github.event.issue.title }}`. Link: ${{ github.event.comment.html_url }}" | ||||||||||||||||||||||||||||||||
| secrets: | ||||||||||||||||||||||||||||||||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_GHI }} | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
Comment on lines
+18
to
+24
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 4 days ago To fix the problem, explicitly set The single best change, without altering existing functionality, is to add at the root level of permissions:
contents: readplaced after the Concretely: in
Suggested changeset
1
.github/workflows/issue-notification.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 4 days ago
To fix the problem, explicitly declare
permissionsso theGITHUB_TOKENused by this workflow is restricted to the minimum needed. Since this workflow only reacts to issues and issue comments and sends notifications to Slack via a reusable workflow, it does not need write access to repository contents or other resources. The minimal safe configuration is to setpermissions: { contents: read }at the workflow root, which ensures read-only access to repo contents while still allowing GitHub to expose the issue/comment event payload to the workflow. If the reusable workflow needs more (for example,issues: write), it can be requested there; from the caller’s perspective we keep things as tight as possible without changing any functional behavior.Concretely:
.github/workflows/issue-notification.yml.permissions:block right after thename:line (beforeon:) so it applies to all jobs.contents: readas a minimal, least-privilege default. We are not changing any jobs, conditions, or secrets handling.No additional imports or methods are needed, because this is a YAML configuration change only.