Skip to content

Commit bec3b22

Browse files
authored
Merge branch 'main' into docs/base-documentation
2 parents 06f8b08 + f6d832d commit bec3b22

Some content is hidden

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

58 files changed

+12120
-10359
lines changed

.github/workflows/auto-merge.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Dependabot PR auto-merge
2+
3+
on:
4+
workflow_run:
5+
workflows: [on-pull-request]
6+
types: ["completed"]
7+
8+
jobs:
9+
auto-merge:
10+
name: Auto-merge
11+
runs-on: ubuntu-latest
12+
# Run this only when the previous workflow was successfull & the initial actor was dependabot
13+
if: ${{ github.event.workflow_run.conclusion == 'success' && github.actor == 'dependabot[bot]' }}
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Download PR artifact
17+
uses: actions/github-script@v5
18+
with:
19+
script: |
20+
const fs = require('fs');
21+
22+
// Get all artifacts
23+
const artifacts = await github.actions.listWorkflowRunArtifacts({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
run_id: ${{github.event.workflow_run.id }},
27+
});
28+
29+
// Identify the artifact of the PR
30+
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
31+
return artifact.name == "pr"
32+
})[0];
33+
34+
// Download the actual artifact
35+
const download = await github.actions.downloadArtifact({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
artifact_id: matchArtifact.id,
39+
archive_format: 'zip',
40+
});
41+
42+
// Write it to disk
43+
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
44+
- name: Unzip artifact
45+
run: unzip pr.zip
46+
- name: Merge PR
47+
uses: actions/github-script@v5
48+
with:
49+
script: |
50+
const fs = require('fs');
51+
const pullNumber = Number(fs.readFileSync('./NR'));
52+
53+
// Create a review
54+
github.pulls.createReview({
55+
owner: context.payload.repository.owner.login,
56+
repo: context.payload.repository.name,
57+
pull_number: pullNumber,
58+
event: 'APPROVE'
59+
})
60+
61+
// Merge PR
62+
github.pulls.merge({
63+
owner: context.payload.repository.owner.login,
64+
repo: context.payload.repository.name,
65+
pull_number: pullNumber,
66+
merge_method: 'squash'
67+
})
68+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/on-pull-request.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ jobs:
2424
- name: Collate Coverage Reports
2525
if: ${{ github.actor != 'dependabot[bot]' }}
2626
run: |
27-
mkdir -p coverage
2827
for d in ./packages/*/ ; do
28+
mkdir -p coverage
29+
if [[ ! -f coverage/lcov.info ]]
30+
then
31+
continue
32+
fi
2933
filename="$d""coverage/lcov.info"
3034
targetSource="SF:""$d""src"
3135
sed "s|SF:src|$targetSource|g" $filename >> coverage/lcov.info

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run lerna-lint

.husky/pre-push

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run test

CONTRIBUTING.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,22 @@ Contributions via pull requests are much appreciated. Before sending us a pull r
2828
1. You are working against the latest source on the **main** branch.
2929
2. You check existing open, and recently merged pull requests to make sure someone else hasn't addressed the problem already.
3030
3. You open an [RFC issue](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new?assignees=&labels=RFC%2C+triage&template=rfc.md&title=RFC%3A+) to discuss any significant work - we would hate for your time to be wasted.
31+
4. You lint and test the code. When you've setup the repository with `npm run init-environment`, pre-commit and push-hooks will automatically lint and test the code. Pull request builds will run the same checks as well.
3132

3233
### Dev setup
3334

3435
To send us a pull request, please follow these steps:
3536

3637
1. Fork the repository.
3738
2. Install dependencies: `npm install`
38-
3. Create a new branch to focus on the specific change you are contributing e.g. `git checkout -b improv/logger-debug-sampling`
39-
4. Run all tests, and code baseline checks: `npm run test`
40-
5. Commit to your fork using clear commit messages.
41-
6. Send us a pull request with a [conventional semantic title](https://github.com/awslabs/aws-lambda-powertools-typescript/pull/67), and answering any default questions in the pull request interface.
42-
7. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
43-
44-
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
39+
3. Prepare utilities like commit hooks: `npm run init-environment`
40+
4. Create a new branch to focus on the specific change you are contributing e.g. `git checkout -b improv/logger-debug-sampling`
41+
5. Run all tests, and code baseline checks: `npm run test`
42+
6. Commit to your fork using clear commit messages.
43+
7. Send us a pull request with a [conventional semantic title](https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/.github/semantic.yml), and answering any default questions in the pull request interface. [Here's an example](https://github.com/awslabs/aws-lambda-powertools-python/pull/67).
44+
8. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
45+
46+
GitHub provides an additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
4547
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
4648

4749
#### Local documentation

0 commit comments

Comments
 (0)