Skip to content

Commit 2ad6683

Browse files
authored
2 parents 5d497f9 + a37ad87 commit 2ad6683

File tree

274 files changed

+41040
-5172
lines changed

Some content is hidden

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

274 files changed

+41040
-5172
lines changed

.github/workflows/README.md

+40-2
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,96 @@ These workflows and actions are configured in the AWS CDK GitHub repository.
55
## Pull Request Triggered
66

77
### Auto Approve
8+
89
[auto-approve.yml](auto-approve.yml): Approves merging PRs with the
910
`auto-approve` label.
1011
Owner: Core CDK team
1112

13+
### PR Linter Trigger
14+
15+
[pr-linter-trigger.yml](pr-linter-trigger.yml): A workflow triggered by `pull_request_review`
16+
that uploads necessary information about the pull request and then triggers the
17+
[pr-linter](pr-linter.yml). Necessary because the `pull_request_review` trigger runs actions
18+
on the merge branch not the base branch (with its secrets).
19+
Owner: Core CDK team
20+
1221
### PR Linter
22+
1323
[pr-linter.yml](pr-linter.yml): Runs `tools/@aws-cdk-prlint` on each PR to
1424
check for correctness.
1525
Owner: Core CDK team
1626

1727
### v2-main PR automation
28+
1829
[v2-pull-request.yml](v2-pull-request.yml): Runs `pkglint` on merge forward PRs
1930
and commits the results.
2031
Owner: Core CDK team
2132

2233
### Label Assigner
34+
2335
[issue-label-assign.yml](issue-label-assign.yml): Github action for automatically adding labels and/or setting assignees when an Issue or PR is opened or edited based on user-defined Area
2436
Owner: CDK support team
2537

2638
### PR Labeler
27-
[pr-labeler.yml](pr-labeler.yml): GitHub action for automatically porting triage labels from issues
39+
40+
[pr-labeler.yml](pr-labeler.yml): GitHub action for automatically porting triage labels from issues
2841
linked in the PR description to the PR.
2942
Owner: Core CDK team
3043

3144
### GitHub Merit Badger
45+
3246
[github-merit-badger.yml](github-merit-badger.yml): GitHub action that adds 'merit badges' to pull
3347
requests based on the users prior contributions to the CDK.
3448
Owner: Core CDK team
3549

50+
### Request CLI Integ Test
51+
52+
[request-cli-integ-test.yml](request-cli-integ-test.yml):
53+
Checks for relevant changes to the CLI code and requests a deployment to the `test-pipeline` environment.
54+
When approved this pushes the PR to the testing pipeline,
55+
thus starting the cli integ test build.
56+
Owner: Core CDK team
57+
3658
## Issue Triggered
3759

3860
### Closed Issue Message
61+
3962
[closed-issue-message.yml](closed-issue-message.yml): Adds a reminder message
4063
to issues that are closed.
4164
Owner: CDK support team
4265

4366
### Label Assigner
67+
4468
[issue-label-assign.yml](issue-label-assign.yml): Github action for automatically adding labels and/or setting assignees when an Issue or PR is opened or edited based on user-defined Area
4569
Owner: CDK support team
4670

4771
## Scheduled Actions
4872

4973
### Issue Lifecycle Handling
74+
5075
[close-stale-issues.yml](close-stale-issues.yml): Handles labeling issues and
5176
PRs with `closing-soon`, `response-requested`, etc.
5277
Owner: CDK support team
5378

5479
### Yarn Upgrader
80+
5581
[yarn-upgrade.yml](yarn-upgrade.yml): Upgrades yarn dependencies and creates a
5682
patch file for downloading.
5783
Owner: Core CDK team
5884

85+
### AWS Service Spec Update
86+
87+
[spec-update.yml](spec-update.yml): Updates AWS Service Spec and related packages to their latest versions
88+
and submits an auto-approve PR for it.
89+
Owner: Core CDK team
90+
5991
### Issue Reprioritizer
92+
6093
[issue-reprioritization.yml](issue-reprioritization.yml): GitHub action that labels `p2`
6194
issues as `p1` if a certain level of community engagement is met.
62-
Owner: Core CDK team
95+
Owner: Core CDK team
96+
97+
### Issue Metrics
98+
99+
[repo-metrics.yml](repo-metrics.yml): GitHub action that runs monthly to report on metrics for issues and PRs created last month.
100+
Owner: Core CDK team

.github/workflows/github-merit-badger.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ jobs:
1717
badges: '[beginning-contributor,repeat-contributor,valued-contributor,admired-contributor,star-contributor,distinguished-contributor]'
1818
thresholds: '[0,3,6,13,25,50]'
1919
badge-type: 'achievement'
20-
ignore-usernames: '[RomainMuller,rix0rrr,MrArnoldPalmer,iliapolo,otaviomacedo,madeline-k,kaizencc,comcalvi,corymhall,peterwoodworth,ryparker,TheRealAmazonKendra,vinayak-kukreja,Naumel,mrgrain,pahud,cgarvis,kellertk,HBobertz,sumupitchayan,pattasai,SankyRed,udaypant,colifran,khushail,aws-cdk-automation,dependabot[bot],mergify[bot]]'
20+
ignore-usernames: '[RomainMuller,rix0rrr,MrArnoldPalmer,iliapolo,otaviomacedo,madeline-k,kaizencc,comcalvi,corymhall,peterwoodworth,ryparker,TheRealAmazonKendra,vinayak-kukreja,Naumel,mrgrain,pahud,cgarvis,kellertk,HBobertz,sumupitchayan,pattasai,SankyRed,udaypant,colifran,khushail,scanlonp,aws-cdk-automation,dependabot[bot],mergify[bot]]'
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: PR Linter Trigger
2+
3+
on:
4+
pull_request_review:
5+
types: [submitted, edited, dismissed]
6+
7+
jobs:
8+
upload:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Save PR number
13+
env:
14+
PR_NUMBER: ${{ github.event.pull_request.number }}
15+
PR_SHA: ${{ github.event.pull_request.head.sha }}
16+
run: |
17+
mkdir -p ./pr
18+
echo $PR_NUMBER > ./pr/pr_number
19+
echo $PR_SHA > ./pr/pr_sha
20+
- uses: actions/upload-artifact@v3
21+
with:
22+
name: pr_info
23+
path: pr/

.github/workflows/pr-linter.yml

+51-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
name: PR Linter
55
on:
6-
# Necessary to have sufficient permissions to write to the PR
76
pull_request_target:
87
types:
98
- labeled
@@ -12,18 +11,65 @@ on:
1211
- opened
1312
- synchronize
1413
- reopened
14+
workflow_run:
15+
workflows: [PR Linter Trigger]
16+
types:
17+
- completed
1518
status:
1619

1720
jobs:
21+
download-if-workflow-run:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
pr_number: ${{ steps.pr_output.outputs.pr_number }}
25+
pr_sha: ${{ steps.pr_output.outputs.pr_sha }}
26+
# if conditions on all individual steps because subsequent jobs depend on this job
27+
# and we cannot skip it entirely
28+
steps:
29+
- name: 'Download artifact'
30+
if: github.event_name == 'workflow_run'
31+
uses: actions/github-script@v6
32+
with:
33+
script: |
34+
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
run_id: context.payload.workflow_run.id,
38+
});
39+
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
40+
return artifact.name == "pr_info"
41+
})[0];
42+
let download = await github.rest.actions.downloadArtifact({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
artifact_id: matchArtifact.id,
46+
archive_format: 'zip',
47+
});
48+
let fs = require('fs');
49+
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_info.zip`, Buffer.from(download.data));
50+
- name: 'Unzip artifact'
51+
if: github.event_name == 'workflow_run'
52+
run: unzip pr_info.zip
53+
54+
- name: 'Make GitHub output'
55+
if: github.event_name == 'workflow_run'
56+
id: 'pr_output'
57+
run: |
58+
echo "cat pr_number"
59+
echo "pr_number=$(cat pr_number)" >> "$GITHUB_OUTPUT"
60+
echo "cat pr_sha"
61+
echo "pr_sha=$(cat pr_sha)" >> "$GITHUB_OUTPUT"
62+
1863
validate-pr:
64+
# Necessary to have sufficient permissions to write to the PR
1965
permissions:
2066
contents: read
2167
pull-requests: write
2268
statuses: read
2369
issues: read
2470
runs-on: ubuntu-latest
71+
needs: download-if-workflow-run
2572
steps:
26-
2773
- name: Checkout
2874
uses: actions/checkout@v3
2975

@@ -34,4 +80,7 @@ jobs:
3480
uses: ./tools/@aws-cdk/prlint
3581
env:
3682
GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }}
83+
# PR_NUMBER and PR_SHA is empty if triggered by pull_request_target, since we already have that info
84+
PR_NUMBER: ${{ needs.download-if-workflow-run.outputs.pr_number }}
85+
PR_SHA: ${{ needs.download-if-workflow-run.outputs.pr_sha }}
3786
REPO_ROOT: ${{ github.workspace }}

.github/workflows/repo-metrics.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Monthly repo metrics
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 2 1 * *'
6+
7+
permissions:
8+
issues: write
9+
pull-requests: read
10+
11+
jobs:
12+
build:
13+
name: metrics
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Get dates for last month
18+
shell: bash
19+
run: |
20+
# Calculate the first day of the previous month
21+
first_day=$(date -d "last month" +%Y-%m-01)
22+
23+
# Calculate the last day of the previous month
24+
last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)
25+
26+
# Set an environment variable with the date range
27+
echo "$first_day..$last_day"
28+
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
29+
30+
- name: Report on issues
31+
uses: github/issue-metrics@v2
32+
env:
33+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
SEARCH_QUERY: 'repo:aws/aws-cdk is:issue created:${{ env.last_month }} -reason:"not planned"'
35+
36+
- name: Create report for issues
37+
uses: peter-evans/create-issue-from-file@v4
38+
with:
39+
title: Monthly issue metrics report
40+
token: ${{ secrets.GITHUB_TOKEN }}
41+
content-filepath: ./issue_metrics.md
42+
assignees: evgenyka
43+
44+
- name: Report on PRs
45+
uses: github/issue-metrics@v2
46+
env:
47+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
SEARCH_QUERY: 'repo:aws/aws-cdk is:pr created:${{ env.last_month }} -is:draft'
49+
50+
- name: Create report for PRs
51+
uses: peter-evans/create-issue-from-file@v4
52+
with:
53+
title: Monthly issue metrics report
54+
token: ${{ secrets.GITHUB_TOKEN }}
55+
content-filepath: ./issue_metrics.md
56+
assignees: evgenyka
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Request a deployment to the test pipeline
2+
3+
name: request-cli-integ-test
4+
on:
5+
pull_request_target: {}
6+
7+
jobs:
8+
cli-changes:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
any-changed-files: ${{ steps.changed-cli-files.outputs.cli_any_changed }}
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
with:
16+
ref: ${{ github.event.pull_request.head.ref }}
17+
repository: ${{ github.event.pull_request.head.repo.full_name }}
18+
fetch-depth: 0
19+
persist-credentials: false
20+
- name: Find changed cli files
21+
id: changed-cli-files
22+
uses: tj-actions/changed-files@920e7b9ae1d45913fc81f86c956fee89c77d2e5e
23+
with:
24+
base_sha: ${{ github.event.pull_request.base.sha }}
25+
files_yaml: |
26+
cli:
27+
- packages/aws-cdk/bin/**
28+
- packages/aws-cdk/lib/**
29+
- packages/aws-cdk/test/**
30+
submit-to-test-pipeline:
31+
environment: test-pipeline
32+
needs: cli-changes
33+
if: needs.cli-changes.outputs.any-changed-files == 'true'
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v3
38+
with:
39+
# Needs to run with PROJEN_GITHUB_TOKEN because we need permissions to force push the branch
40+
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
41+
ref: ${{ github.event.pull_request.head.ref }}
42+
repository: ${{ github.event.pull_request.head.repo.full_name }}
43+
- name: Submit to test-pipeline
44+
run: |
45+
git config --global user.name 'aws-cdk-automation'
46+
git config --global user.email '[email protected]'
47+
git push --force --atomic https://github.com/${{ github.repository }}.git FETCH_HEAD:test-main-pipeline
48+
- name: Explain next steps
49+
uses: thollander/actions-comment-pull-request@dadb7667129e23f12ca3925c90dc5cd7121ab57e
50+
with:
51+
message: |
52+
:arrow_right: **PR build request submitted to `test-main-pipeline`** :arrow_left:
53+
54+
A maintainer must now check the pipeline and add the `pr-linter/cli-integ-tested` label once the pipeline succeeds.
55+
comment_tag: request-cli-integ-test
56+
mode: recreate
57+
# Post as our automation user
58+
GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }}

0 commit comments

Comments
 (0)