-
Notifications
You must be signed in to change notification settings - Fork 156
chore(ci): refactor workflows to scope permissions #1978
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
Merged
Merged
Changes from all commits
Commits
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,50 @@ | ||
const { | ||
PR_ACTION, | ||
PR_AUTHOR, | ||
PR_BODY, | ||
PR_NUMBER, | ||
IGNORE_AUTHORS, | ||
LABEL_BLOCK, | ||
LABEL_BLOCK_MISSING_LICENSE_AGREEMENT, | ||
} = require('./constants'); | ||
|
||
module.exports = async ({ github, context, core }) => { | ||
if (IGNORE_AUTHORS.includes(PR_AUTHOR)) { | ||
return core.notice('Author in IGNORE_AUTHORS list; skipping...'); | ||
} | ||
|
||
if (PR_ACTION != 'opened') { | ||
return core.notice( | ||
'Only newly open PRs are labelled to avoid spam; skipping' | ||
); | ||
} | ||
|
||
const RELATED_ACK_SECTION_REGEX = | ||
/By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice./; | ||
|
||
const isMatch = RELATED_ACK_SECTION_REGEX.exec(PR_BODY); | ||
|
||
if (isMatch == null) { | ||
core.info( | ||
`No acknowledgement section found, maybe the author didn't use the template but there is one.` | ||
); | ||
|
||
const msg = | ||
"No acknowledgement section found. Please make sure you used the template to open a PR and didn't remove the acknowledgment section. Check the template here: https://github.com/aws-powertools/powertools-lambda-python/blob/develop/.github/PULL_REQUEST_TEMPLATE.md#acknowledgment"; | ||
|
||
await Promise.allSettled([ | ||
github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: msg, | ||
issue_number: PR_NUMBER, | ||
}), | ||
github.rest.issues.addLabels({ | ||
issue_number: PR_NUMBER, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: [LABEL_BLOCK, LABEL_BLOCK_MISSING_LICENSE_AGREEMENT], | ||
}), | ||
]); | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,34 @@ | ||
name: Closed Issue Message | ||
|
||
# PROCESS | ||
# | ||
# 1. Comment on recently closed issues to warn future responses may not be looked after | ||
|
||
# USAGE | ||
# | ||
# Always triggered upon issue closure | ||
|
||
on: | ||
issues: | ||
types: [closed] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
auto_comment: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write # comment on issues | ||
steps: | ||
- uses: aws-actions/closed-issue-message@36b7048ea77bb834d16e7a7c5b5471ac767a4ca1 # v1.0.0 | ||
with: | ||
repo-token: "${{ secrets.GITHUB_TOKEN }}" | ||
message: | | ||
⚠️ **COMMENT VISIBILITY WARNING** ⚠️ | ||
|
||
This issue is now closed. Please be mindful that future comments are hard for our team to see. | ||
|
||
If you need more assistance, please either tag a [team member](https://docs.powertools.aws.dev/lambda/typescript/latest/maintainers/#current-maintainers) or open a new issue that references this one. | ||
|
||
If you wish to keep having a conversation with other community members under this issue feel free to do so. |
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
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.
Uh oh!
There was an error while loading. Please reload this page.