Skip to content

Commit a78e483

Browse files
authored
Merge pull request #38 from aws-samples/develop
maintenance: merging latest v1 changes with main
2 parents 6edc7a5 + 3379647 commit a78e483

File tree

83 files changed

+3515
-2143
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+3515
-2143
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
2+
3+
* @aws-samples/aws-serverless-developer-experience-workshop-py

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Bug report
2+
description: Report a reproducible bug to help us improve
3+
title: "Bug: TITLE"
4+
labels: ["bug", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thank you for submitting a bug report. Please add as much information as possible to help us reproduce, and remove any potential sensitive data.
10+
- type: textarea
11+
id: expected_behaviour
12+
attributes:
13+
label: Expected Behaviour
14+
description: Please share details on the behaviour you expected
15+
validations:
16+
required: true
17+
- type: textarea
18+
id: current_behaviour
19+
attributes:
20+
label: Current Behaviour
21+
description: Please share details on the current issue
22+
validations:
23+
required: true
24+
- type: textarea
25+
id: code_snippet
26+
attributes:
27+
label: Code snippet
28+
description: Please share a code snippet to help us reproduce the issue
29+
render: csharp
30+
validations:
31+
required: true
32+
- type: textarea
33+
id: solution
34+
attributes:
35+
label: Possible Solution
36+
description: If known, please suggest a potential resolution
37+
validations:
38+
required: false
39+
- type: textarea
40+
id: steps
41+
attributes:
42+
label: Steps to Reproduce
43+
description: Please share how we might be able to reproduce this issue
44+
validations:
45+
required: true
46+
- type: textarea
47+
id: logs
48+
attributes:
49+
label: Debugging logs
50+
description: If available, please share debugging logs
51+
render: csharp
52+
validations:
53+
required: false
54+
- type: markdown
55+
attributes:
56+
value: |
57+
--
58+
**Disclaimer**: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Maintenance
2+
description: Suggest an activity to help address tech debt, governance, and anything internal
3+
title: "Maintenance: TITLE"
4+
labels: ["internal", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thank you for taking the time to help us improve operational excellence.
10+
11+
*Future readers*: Please react with 👍 and your use case to help us understand customer demand.
12+
- type: textarea
13+
id: activity
14+
attributes:
15+
label: Summary
16+
description: Please provide an overview in one or two paragraphs
17+
validations:
18+
required: true
19+
- type: textarea
20+
id: importance
21+
attributes:
22+
label: Why is this needed?
23+
description: Please help us understand the value so we can prioritize it accordingly
24+
validations:
25+
required: true
26+
- type: textarea
27+
id: suggestion
28+
attributes:
29+
label: Solution
30+
description: If available, please share what a good solution would look like
31+
validations:
32+
required: false
33+
- type: markdown
34+
attributes:
35+
value: |
36+
---
37+
**Disclaimer**: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
**Issue number:**
2+
3+
## Summary
4+
5+
### Changes
6+
7+
> Please provide a summary of what's being changed
8+
9+
### User experience
10+
11+
> Please share what the user experience looks like before and after this change
12+
13+
## Checklist
14+
15+
Please leave checklist items unchecked if they do not apply to your change.
16+
17+
* [ ] I have performed a self-review of this change
18+
* [ ] Changes have been tested
19+
* [ ] Changes are documented
20+
* [ ] PR title follows [conventional commit semantics](https://github.com/aws-samples/aws-serverless-developer-experience-workshop-python/blob/develop/.github/semantic.yml)
21+
22+
## Acknowledgment
23+
24+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
25+
26+
**Disclaimer**: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

.github/auto_assign.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Set to true to add reviewers to pull requests
2+
addReviewers: true
3+
4+
# Set to true to add assignees to pull requests
5+
addAssignees: true
6+
7+
# A list of reviewers to be added to pull requests (GitHub user name)
8+
reviewers:
9+
- igorlg
10+
11+
# A number of reviewers added to the pull request
12+
# Set 0 to add all the reviewers (default: 0)
13+
numberOfReviewers: 1
14+
15+
# A list of assignees, overrides reviewers if set
16+
# assignees:
17+
# - sliedig
18+
19+
# A number of assignees to add to the pull request
20+
# Set to 0 to add all of the assignees.
21+
# Uses numberOfReviewers if unset.
22+
numberOfAssignees: 0
23+
24+
# A list of keywords to be skipped the process that add reviewers if pull requests include it
25+
# skipKeywords:
26+
# - wip

.github/boring-cyborg.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
##### Labeler ##########################################################################################################
2+
labelPRBasedOnFilePath:
3+
service/contracts:
4+
- Unicorn.Contracts
5+
service/properties:
6+
- Unicorn.Properties
7+
service/web:
8+
- Unicorn.Web
9+
10+
internal:
11+
- .github/*
12+
- .github/**/*
13+
- .chglog/*
14+
- .flake8
15+
- .gitignore
16+
- .pre-commit-config.yaml
17+
- Makefile
18+
- CONTRIBUTING.md
19+
- CODE_OF_CONDUCT.md
20+
- LICENSE
21+
22+
##### Greetings ########################################################################################################
23+
firstPRWelcomeComment: >
24+
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
25+
26+
# Comment to be posted to congratulate user on their first merged PR
27+
firstPRMergeComment: >
28+
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!
29+
30+
# Comment to be posted to on first time issues
31+
firstIssueWelcomeComment: >
32+
Thanks for opening your first issue here! We'll come back to you as soon as we can.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
const {
2+
PR_NUMBER,
3+
PR_ACTION,
4+
PR_AUTHOR,
5+
IGNORE_AUTHORS,
6+
} = require("./constants")
7+
8+
9+
/**
10+
* Notify PR author to split XXL PR in smaller chunks
11+
*
12+
* @param {object} core - core functions instance from @actions/core
13+
* @param {object} gh_client - Pre-authenticated REST client (Octokit)
14+
* @param {string} owner - GitHub Organization
15+
* @param {string} repository - GitHub repository
16+
*/
17+
const notifyAuthor = async ({
18+
core,
19+
gh_client,
20+
owner,
21+
repository,
22+
}) => {
23+
core.info(`Commenting on PR ${PR_NUMBER}`)
24+
25+
let msg = `### ⚠️Large PR detected⚠️
26+
27+
Please consider breaking into smaller PRs to avoid significant review delays. Ignore if this PR has naturally grown to this size after reviews.
28+
`;
29+
30+
try {
31+
await gh_client.rest.issues.createComment({
32+
owner: owner,
33+
repo: repository,
34+
body: msg,
35+
issue_number: PR_NUMBER,
36+
});
37+
} catch (error) {
38+
core.setFailed("Failed to notify PR author to split large PR");
39+
console.error(err);
40+
}
41+
}
42+
43+
module.exports = async ({github, context, core}) => {
44+
if (IGNORE_AUTHORS.includes(PR_AUTHOR)) {
45+
return core.notice("Author in IGNORE_AUTHORS list; skipping...")
46+
}
47+
48+
if (PR_ACTION != "labeled") {
49+
return core.notice("Only run on PRs labeling actions; skipping")
50+
}
51+
52+
53+
/** @type {string[]} */
54+
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
issue_number: PR_NUMBER,
58+
})
59+
60+
// Schema: https://docs.github.com/en/rest/issues/labels#list-labels-for-an-issue
61+
for (const label of labels) {
62+
core.info(`Label: ${label}`)
63+
if (label.name == "size/XXL") {
64+
await notifyAuthor({
65+
core: core,
66+
gh_client: github,
67+
owner: context.repo.owner,
68+
repository: context.repo.repo,
69+
})
70+
break;
71+
}
72+
}
73+
}

.github/scripts/constants.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module.exports = Object.freeze({
2+
/** @type {string} */
3+
// Values: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
4+
"PR_ACTION": process.env.PR_ACTION?.replace(/"/g, '') || "",
5+
6+
/** @type {string} */
7+
"PR_AUTHOR": process.env.PR_AUTHOR?.replace(/"/g, '') || "",
8+
9+
/** @type {string} */
10+
"PR_BODY": process.env.PR_BODY || "",
11+
12+
/** @type {string} */
13+
"PR_TITLE": process.env.PR_TITLE || "",
14+
15+
/** @type {number} */
16+
"PR_NUMBER": process.env.PR_NUMBER || 0,
17+
18+
/** @type {string} */
19+
"PR_IS_MERGED": process.env.PR_IS_MERGED || "false",
20+
21+
/** @type {string} */
22+
"LABEL_BLOCK": "do-not-merge",
23+
24+
/** @type {string} */
25+
"LABEL_BLOCK_REASON": "need-issue",
26+
27+
/** @type {string} */
28+
"LABEL_BLOCK_MISSING_LICENSE_AGREEMENT": "need-license-agreement-acknowledge",
29+
30+
/** @type {string} */
31+
"LABEL_PENDING_RELEASE": "pending-release",
32+
33+
/** @type {string[]} */
34+
"IGNORE_AUTHORS": ["dependabot[bot]", "markdownify[bot]"],
35+
36+
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = async ({github, context, core}) => {
2+
const fs = require('fs');
3+
4+
const workflowRunId = process.env.WORKFLOW_ID;
5+
core.info(`Listing artifacts for workflow run ${workflowRunId}`);
6+
7+
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
8+
owner: context.repo.owner,
9+
repo: context.repo.repo,
10+
run_id: workflowRunId,
11+
});
12+
13+
const matchArtifact = artifacts.data.artifacts.filter(artifact => artifact.name == "pr")[0];
14+
15+
core.info(`Downloading artifacts for workflow run ${workflowRunId}`);
16+
const artifact = await github.rest.actions.downloadArtifact({
17+
owner: context.repo.owner,
18+
repo: context.repo.repo,
19+
artifact_id: matchArtifact.id,
20+
archive_format: 'zip',
21+
});
22+
23+
core.info("Saving artifact found", artifact);
24+
25+
fs.writeFileSync('pr.zip', Buffer.from(artifact.data));
26+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const {
2+
PR_ACTION,
3+
PR_AUTHOR,
4+
PR_BODY,
5+
PR_NUMBER,
6+
IGNORE_AUTHORS,
7+
LABEL_BLOCK,
8+
LABEL_BLOCK_REASON
9+
} = require("./constants")
10+
11+
module.exports = async ({github, context, core}) => {
12+
if (IGNORE_AUTHORS.includes(PR_AUTHOR)) {
13+
return core.notice("Author in IGNORE_AUTHORS list; skipping...")
14+
}
15+
16+
if (PR_ACTION != "opened") {
17+
return core.notice("Only newly open PRs are labelled to avoid spam; skipping")
18+
}
19+
20+
const RELATED_ISSUE_REGEX = /Issue number:[^\d\r\n]+(?<issue>\d+)/;
21+
const isMatch = RELATED_ISSUE_REGEX.exec(PR_BODY);
22+
if (isMatch == null) {
23+
core.info(`No related issue found, maybe the author didn't use the template but there is one.`)
24+
25+
let msg = "No related issues found. Please ensure there is an open issue related to this change to avoid significant delays or closure.";
26+
await github.rest.issues.createComment({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
body: msg,
30+
issue_number: PR_NUMBER,
31+
});
32+
33+
return await github.rest.issues.addLabels({
34+
issue_number: PR_NUMBER,
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
labels: [LABEL_BLOCK, LABEL_BLOCK_REASON]
38+
})
39+
}
40+
}

0 commit comments

Comments
 (0)