Skip to content

Commit 8fd346c

Browse files
authored
Merge pull request #8 from sliedig/test-fix
fix: Resolved test issues
2 parents 45e49e9 + cf1e211 commit 8fd346c

30 files changed

+908
-192
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

.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: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!-- markdownlint-disable MD041 MD043 -->
2+
**Issue number:**
3+
4+
## Summary
5+
6+
### Changes
7+
8+
> Please provide a summary of what's being changed
9+
10+
### User experience
11+
12+
> Please share what the user experience looks like before and after this change
13+
14+
## Checklist
15+
16+
Please leave checklist items unchecked if they do not apply to your change.
17+
18+
* [ ] I have performed a self-review of this change
19+
* [ ] Changes have been tested
20+
* [ ] Changes are documented
21+
* [ ] PR title follows [conventional commit semantics](https://github.com/aws-samples/aws-serverless-developer-experience-workshop-dotnet/blob/develop/.github/semantic.yml)
22+
23+
24+
<details>
25+
<summary>Is this a breaking change?</summary>
26+
27+
**RFC issue number**:
28+
29+
Checklist:
30+
31+
* [ ] Migration process documented
32+
* [ ] Implement warnings (if it can live side by side)
33+
34+
</details>
35+
36+
## Acknowledgment
37+
38+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
39+
40+
**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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
- sliedig
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+
16+
# A number of assignees to add to the pull request
17+
# Set to 0 to add all of the assignees.
18+
# Uses numberOfReviewers if unset.
19+
# numberOfAssignees: 2
20+
21+
# A list of keywords to be skipped the process that add reviewers if pull requests include it
22+
# skipKeywords:
23+
# - 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.

.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: 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+
}
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+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const { PR_NUMBER, PR_TITLE } = require("./constants")
2+
3+
module.exports = async ({github, context, core}) => {
4+
const FEAT_REGEX = /feat(\((.+)\))?(:.+)/
5+
const BUG_REGEX = /(fix|bug)(\((.+)\))?(:.+)/
6+
const DOCS_REGEX = /(docs|doc)(\((.+)\))?(:.+)/
7+
const CHORE_REGEX = /(chore)(\((.+)\))?(:.+)/
8+
const DEPRECATED_REGEX = /(deprecated)(\((.+)\))?(:.+)/
9+
const REFACTOR_REGEX = /(refactor)(\((.+)\))?(:.+)/
10+
11+
const labels = {
12+
"feature": FEAT_REGEX,
13+
"bug": BUG_REGEX,
14+
"documentation": DOCS_REGEX,
15+
"internal": CHORE_REGEX,
16+
"enhancement": REFACTOR_REGEX,
17+
"deprecated": DEPRECATED_REGEX,
18+
}
19+
20+
// Maintenance: We should keep track of modified PRs in case their titles change
21+
let miss = 0;
22+
try {
23+
for (const label in labels) {
24+
const matcher = new RegExp(labels[label])
25+
const matches = matcher.exec(PR_TITLE)
26+
if (matches != null) {
27+
core.info(`Auto-labeling PR ${PR_NUMBER} with ${label}`)
28+
29+
await github.rest.issues.addLabels({
30+
issue_number: PR_NUMBER,
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
labels: [label]
34+
})
35+
36+
return;
37+
} else {
38+
core.debug(`'${PR_TITLE}' didn't match '${label}' semantic.`)
39+
miss += 1
40+
}
41+
}
42+
} finally {
43+
if (miss == Object.keys(labels).length) {
44+
core.notice(`PR ${PR_NUMBER} title '${PR_TITLE}' doesn't follow semantic titles; skipping...`)
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)