Skip to content
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

chore(ci): updated github actions and templates #123

Merged
merged 23 commits into from
Jul 18, 2022
Merged

chore(ci): updated github actions and templates #123

merged 23 commits into from
Jul 18, 2022

Conversation

sliedig
Copy link
Contributor

@sliedig sliedig commented Jul 18, 2022

Issue #, if available:

Description of changes:

Updated GitHub actions and template. Cleaned up unused actions. Added apps to assists with automation.

Checklist

Breaking change checklist

RFC issue #:

  • Migration process documented
  • Implement warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.


View rendered SECURITY.md

@boring-cyborg boring-cyborg bot added the internal Maintenance changes label Jul 18, 2022
@sliedig sliedig requested a review from heitorlessa July 18, 2022 11:58
@heitorlessa heitorlessa changed the title chore: updated github actions and templates chore(ci): updated github actions and templates Jul 18, 2022
Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two suggestions (leftover plus two labels you missed). I'll double check the latest fixes we've made in the labeling workflows and bring a new security hardening workflow over

.github/auto_assign.yml Outdated Show resolved Hide resolved
.github/boring-cyborg.yml Show resolved Hide resolved
sliedig and others added 2 commits July 18, 2022 21:13
Co-authored-by: Heitor Lessa <heitor.lessa@hotmail.com>
Co-authored-by: Heitor Lessa <heitor.lessa@hotmail.com>
Comment on lines 1 to 60
const { PR_NUMBER, PR_TITLE, AREAS } = require("./constants")

module.exports = async ({github, context, core}) => {
const FEAT_REGEX = /feat(\((.+)\))?(\:.+)/
const BUG_REGEX = /(fix|bug)(\((.+)\))?(\:.+)/
const DOCS_REGEX = /(docs|doc)(\((.+)\))?(\:.+)/
const CHORE_REGEX = /(chore)(\((.+)\))?(\:.+)/
const DEPRECATED_REGEX = /(deprecated)(\((.+)\))?(\:.+)/
const REFACTOR_REGEX = /(refactor)(\((.+)\))?(\:.+)/

const labels = {
"feature": FEAT_REGEX,
"bug": BUG_REGEX,
"documentation": DOCS_REGEX,
"internal": CHORE_REGEX,
"enhancement": REFACTOR_REGEX,
"deprecated": DEPRECATED_REGEX,
}

// Maintenance: We should keep track of modified PRs in case their titles change
let miss = 0;
try {
for (const label in labels) {
const matcher = new RegExp(labels[label])
const isMatch = matcher.exec(PR_TITLE)
if (isMatch != null) {
core.info(`Auto-labeling PR ${PR_NUMBER} with ${label}`)

await github.rest.issues.addLabels({
issue_number: PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [label]
})

const area = matches[2]; // second capture group contains the area
if (AREAS.indexOf(area) > -1) {
core.info(`Auto-labeling PR ${PR_NUMBER} with area ${area}`);
await github.rest.issues.addLabels({
issue_number: PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [`area/${area}`],
});
} else {
core.debug(`'${PR_TITLE}' didn't match any known area.`);
}

return;
} else {
core.debug(`'${PR_TITLE}' didn't match '${label}' semantic.`)
miss += 1
}
}
} finally {
if (miss == Object.keys(labels).length) {
return core.notice(`PR ${PR_NUMBER} title '${PR_TITLE}' doesn't follow semantic titles; skipping...`)
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { PR_NUMBER, PR_TITLE, AREAS } = require("./constants")
module.exports = async ({github, context, core}) => {
const FEAT_REGEX = /feat(\((.+)\))?(\:.+)/
const BUG_REGEX = /(fix|bug)(\((.+)\))?(\:.+)/
const DOCS_REGEX = /(docs|doc)(\((.+)\))?(\:.+)/
const CHORE_REGEX = /(chore)(\((.+)\))?(\:.+)/
const DEPRECATED_REGEX = /(deprecated)(\((.+)\))?(\:.+)/
const REFACTOR_REGEX = /(refactor)(\((.+)\))?(\:.+)/
const labels = {
"feature": FEAT_REGEX,
"bug": BUG_REGEX,
"documentation": DOCS_REGEX,
"internal": CHORE_REGEX,
"enhancement": REFACTOR_REGEX,
"deprecated": DEPRECATED_REGEX,
}
// Maintenance: We should keep track of modified PRs in case their titles change
let miss = 0;
try {
for (const label in labels) {
const matcher = new RegExp(labels[label])
const isMatch = matcher.exec(PR_TITLE)
if (isMatch != null) {
core.info(`Auto-labeling PR ${PR_NUMBER} with ${label}`)
await github.rest.issues.addLabels({
issue_number: PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [label]
})
const area = matches[2]; // second capture group contains the area
if (AREAS.indexOf(area) > -1) {
core.info(`Auto-labeling PR ${PR_NUMBER} with area ${area}`);
await github.rest.issues.addLabels({
issue_number: PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [`area/${area}`],
});
} else {
core.debug(`'${PR_TITLE}' didn't match any known area.`);
}
return;
} else {
core.debug(`'${PR_TITLE}' didn't match '${label}' semantic.`)
miss += 1
}
}
} finally {
if (miss == Object.keys(labels).length) {
return core.notice(`PR ${PR_NUMBER} title '${PR_TITLE}' doesn't follow semantic titles; skipping...`)
}
}
}
const { PR_NUMBER, PR_TITLE, AREAS } = require("./constants")
module.exports = async ({github, context, core}) => {
const FEAT_REGEX = /feat(\((.+)\))?(:.+)/
const BUG_REGEX = /(fix|bug)(\((.+)\))?(:.+)/
const DOCS_REGEX = /(docs|doc)(\((.+)\))?(:.+)/
const CHORE_REGEX = /(chore)(\((.+)\))?(:.+)/
const DEPRECATED_REGEX = /(deprecated)(\((.+)\))?(:.+)/
const REFACTOR_REGEX = /(refactor)(\((.+)\))?(:.+)/
const labels = {
"feature": FEAT_REGEX,
"bug": BUG_REGEX,
"documentation": DOCS_REGEX,
"internal": CHORE_REGEX,
"enhancement": REFACTOR_REGEX,
"deprecated": DEPRECATED_REGEX,
}
// Maintenance: We should keep track of modified PRs in case their titles change
let miss = 0;
try {
for (const label in labels) {
const matcher = new RegExp(labels[label])
const matches = matcher.exec(PR_TITLE)
if (matches != null) {
core.info(`Auto-labeling PR ${PR_NUMBER} with ${label}`)
await github.rest.issues.addLabels({
issue_number: PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [label]
})
const area = matches[2]; // second capture group contains the area
if (AREAS.indexOf(area) > -1) {
core.info(`Auto-labeling PR ${PR_NUMBER} with area ${area}`);
await github.rest.issues.addLabels({
issue_number: PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [`area/${area}`],
});
} else {
core.debug(`'${PR_TITLE}' didn't match any known area.`);
}
return;
} else {
core.debug(`'${PR_TITLE}' didn't match '${label}' semantic.`)
miss += 1
}
}
} finally {
if (miss == Object.keys(labels).length) {
core.notice(`PR ${PR_NUMBER} title '${PR_TITLE}' doesn't follow semantic titles; skipping...`)
}
}
}

Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sync label JS file w/ Python. There are a few files missing, so I'll try to include them here in the PR, otherwise you can

Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
@heitorlessa
Copy link
Contributor

heitorlessa commented Jul 18, 2022

Not sure why it closed as I pushed (--with-lease) to the fork branch to update this PR. See if you can reopen (I can't), otherwise the branch sliedig/develop has the latest too for safety reasons.

UPDATE: Added all remaining workflows and scripts to be in sync with Python repo - let me know if there's anything else you need.

@heitorlessa heitorlessa reopened this Jul 18, 2022
@sliedig sliedig merged commit 9ab764f into aws-powertools:develop Jul 18, 2022
@sliedig
Copy link
Contributor Author

sliedig commented Jul 18, 2022

Thanks @heitorlessa !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Maintenance changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants