Skip to content

Commit 787eafe

Browse files
authored
chore: merge master into next-major #755
2 parents 6e75a3b + c6e3ca6 commit 787eafe

32 files changed

+21304
-1959
lines changed

.all-contributorsrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@
119119
"avatar_url": "https://avatars.githubusercontent.com/u/16149591?v=4",
120120
"profile": "https://github.com/aeworxet",
121121
"contributions": [
122-
"test"
122+
"test",
123+
"code"
123124
]
124125
},
125126
{
@@ -182,5 +183,5 @@
182183
}
183184
],
184185
"contributorsPerLine": 4,
185-
"skipCi": true
186+
"skipCi": false
186187
}

.eslintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ env:
44
node: true
55
es6: true
66
jest: true
7+
mocha: true
8+
browser: true
79

810
plugins:
911
- "@typescript-eslint"

.github/workflows/add-good-first-issue-labels.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,37 @@
44
# Purpose of this workflow is to enable anyone to label issue with 'Good First Issue' and 'area/*' with a single command.
55
name: Add 'Good First Issue' and 'area/*' labels # if proper comment added
66

7-
on:
8-
issue_comment:
9-
types:
10-
- created
7+
on:
8+
issue_comment:
9+
types:
10+
- created
1111

1212
jobs:
1313
add-labels:
14-
if: ${{!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot'}}
14+
if: ${{(!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot') && (contains(github.event.comment.body, '/good-first-issue') || contains(github.event.comment.body, '/gfi' ))}}
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Add label
18-
if: contains(github.event.comment.body, '/good-first-issue') || contains(github.event.comment.body, '/gfi' )
19-
uses: actions/github-script@v5
18+
uses: actions/github-script@v6
2019
with:
2120
github-token: ${{ secrets.GH_TOKEN }}
2221
script: |
2322
const areas = ['javascript', 'typescript', 'java' , 'go', 'docs', 'ci-cd', 'design'];
24-
const values = context.payload.comment.body.trim().split(" ");
25-
switch(values[1]){
23+
const words = context.payload.comment.body.trim().split(" ");
24+
const areaIndex = words.findIndex((word)=> word === '/gfi' || word === '/good-first-issue') + 1
25+
let area = words[areaIndex];
26+
switch(area){
2627
case 'ts':
27-
values[1] = 'typescript';
28+
area = 'typescript';
2829
break;
2930
case 'js':
30-
values[1] = 'javascript';
31+
area = 'javascript';
32+
break;
3133
case 'markdown':
32-
values[1] = 'docs';
34+
area = 'docs';
35+
break;
3336
}
34-
if(values.length != 2 || !areas.includes(values[1])){
37+
if(!areas.includes(area)){
3538
const message = `Hey @${context.payload.sender.login}, your message doesn't follow the requirements, you can try \`/help\`.`
3639
3740
await github.rest.issues.createComment({
@@ -42,14 +45,14 @@ jobs:
4245
})
4346
} else {
4447
45-
//remove complexity and areas if there are any before adding new labels;
48+
// remove area if there is any before adding new labels.
4649
const currentLabels = (await github.rest.issues.listLabelsOnIssue({
4750
issue_number: context.issue.number,
4851
owner: context.repo.owner,
4952
repo: context.repo.repo,
5053
})).data.map(label => label.name);
5154
52-
const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(values[1])));
55+
const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(area)));
5356
shouldBeRemoved.forEach(label => {
5457
github.rest.issues.deleteLabel({
5558
owner: context.repo.owner,
@@ -58,11 +61,11 @@ jobs:
5861
});
5962
});
6063
61-
//add new labels
64+
// Add new labels.
6265
github.rest.issues.addLabels({
6366
issue_number: context.issue.number,
6467
owner: context.repo.owner,
6568
repo: context.repo.repo,
66-
labels: ['good first issue', `area/${values[1]}`]
69+
labels: ['good first issue', `area/${area}`]
6770
});
6871
}

.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
name: Label PRs # if proper comment added
99

10-
on:
11-
issue_comment:
12-
types:
13-
- created
10+
on:
11+
issue_comment:
12+
types:
13+
- created
1414

1515
jobs:
1616
add-ready-to-merge-label:
17-
if: >
17+
if: >
1818
github.event.issue.pull_request &&
1919
github.event.issue.state != 'closed' &&
2020
github.actor != 'asyncapi-bot' &&
@@ -25,9 +25,8 @@ jobs:
2525
2626
runs-on: ubuntu-latest
2727
steps:
28-
2928
- name: Add ready-to-merge label
30-
uses: actions/github-script@v5
29+
uses: actions/github-script@v6
3130
with:
3231
github-token: ${{ secrets.GH_TOKEN }}
3332
script: |
@@ -64,7 +63,7 @@ jobs:
6463
Thanks 😄`
6564
})
6665
}
67-
66+
6867
add-do-not-merge-label:
6968
if: >
7069
github.event.issue.pull_request &&
@@ -77,7 +76,7 @@ jobs:
7776
runs-on: ubuntu-latest
7877
steps:
7978
- name: Add do-not-merge label
80-
uses: actions/github-script@v5
79+
uses: actions/github-script@v6
8180
with:
8281
github-token: ${{ secrets.GH_TOKEN }}
8382
script: |
@@ -86,7 +85,7 @@ jobs:
8685
owner: context.repo.owner,
8786
repo: context.repo.repo,
8887
labels: ['do-not-merge']
89-
})
88+
})
9089
add-autoupdate-label:
9190
if: >
9291
github.event.issue.pull_request &&
@@ -99,7 +98,7 @@ jobs:
9998
runs-on: ubuntu-latest
10099
steps:
101100
- name: Add autoupdate label
102-
uses: actions/github-script@v5
101+
uses: actions/github-script@v6
103102
with:
104103
github-token: ${{ secrets.GH_TOKEN }}
105104
script: |
@@ -108,4 +107,4 @@ jobs:
108107
owner: context.repo.owner,
109108
repo: context.repo.repo,
110109
labels: ['autoupdate']
111-
})
110+
})

.github/workflows/automerge-for-humans-merging.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,35 @@ jobs:
2121
if: github.event.pull_request.draft == false && (github.event.pull_request.user.login != 'asyncapi-bot' || github.event.pull_request.user.login != 'dependabot[bot]' || github.event.pull_request.user.login != 'dependabot-preview[bot]') #it runs only if PR actor is not a bot, at least not a bot that we know
2222
runs-on: ubuntu-latest
2323
steps:
24+
- name: Get list of authors
25+
uses: sergeysova/jq-action@v2
26+
id: authors
27+
with:
28+
# This cmd does following (line by line):
29+
# 1. CURL querying the list of commits of the current PR via GH API. Why? Because the current event payload does not carry info about the commits.
30+
# 2. Iterates over the previous returned payload, and creates an array with the filtered results (see below) so we can work wit it later. An example of payload can be found in https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#webhook-payload-example-34.
31+
# 3. Grabs the data we need for adding the `Co-authored-by: ...` lines later and puts it into objects to be used later on.
32+
# 4. Filters the results by excluding the current PR sender. We don't need to add it as co-author since is the PR creator and it will become by default the main author.
33+
# 5. Removes repeated authors (authors can have more than one commit in the PR).
34+
# 6. Builds the `Co-authored-by: ...` lines with actual info.
35+
# 7. Transforms the array into plain text. Thanks to this, the actual stdout of this step can be used by the next Workflow step (wich is basically the automerge).
36+
cmd: |
37+
curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" "${{github.event.pull_request._links.commits.href}}?per_page=100" |
38+
jq -r '[.[]
39+
| {name: .commit.author.name, email: .commit.author.email, login: .author.login}]
40+
| map(select(.login != "${{github.event.pull_request.user.login}}"))
41+
| unique
42+
| map("Co-authored-by: " + .name + " <" + .email + ">")
43+
| join("\n")'
44+
multiline: true
2445
- name: Automerge PR
25-
uses: pascalgn/automerge-action@v0.14.3
46+
uses: pascalgn/automerge-action@22948e0bc22f0aa673800da838595a3e7347e584 #v0.15.6 https://github.com/pascalgn/automerge-action/releases/tag/v0.15.6
2647
env:
2748
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
2849
MERGE_LABELS: "!do-not-merge,ready-to-merge"
2950
MERGE_METHOD: "squash"
30-
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})"
51+
# Using the output of the previous step (`Co-authored-by: ...` lines) as commit description.
52+
# Important to keep 2 empty lines as https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-the-command-line mentions
53+
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})\n\n\n${{ steps.authors.outputs.value }}"
3154
MERGE_RETRIES: "20"
32-
MERGE_RETRY_SLEEP: "30000"
55+
MERGE_RETRY_SLEEP: "30000"

.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,17 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Remove label
19-
uses: actions/github-script@v5
19+
uses: actions/github-script@v6
2020
with:
2121
github-token: ${{ secrets.GH_TOKEN }}
2222
script: |
2323
const labelToRemove = 'ready-to-merge';
2424
const labels = context.payload.pull_request.labels;
25-
2625
const isLabelPresent = labels.some(label => label.name === labelToRemove)
27-
2826
if(!isLabelPresent) return;
29-
3027
github.rest.issues.removeLabel({
3128
issue_number: context.issue.number,
3229
owner: context.repo.owner,
3330
repo: context.repo.repo,
3431
name: labelToRemove
35-
})
32+
})

.github/workflows/automerge-orphans.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ jobs:
1313
name: Find orphans and notify
1414
runs-on: ubuntu-latest
1515
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
1618
- name: Get list of orphans
17-
uses: actions/github-script@v3
19+
uses: actions/github-script@v6
1820
id: orphans
1921
with:
2022
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -50,10 +52,10 @@ jobs:
5052
}
5153
- if: steps.orphans.outputs.found == 'true'
5254
name: Convert markdown to slack markdown
53-
uses: LoveToKnow/slackify-markdown[email protected]
55+
uses: asyncapi/.github/.github/actions/slackify-markdown@master
5456
id: issuemarkdown
5557
with:
56-
text: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})"
58+
markdown: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})"
5759
- if: steps.orphans.outputs.found == 'true'
5860
name: Send info about orphan to slack
5961
uses: rtCamp/action-slack-notify@v2

.github/workflows/automerge.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This action is centrally managed in https://github.com/asyncapi/.github/
22
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo.
33

4-
name: Automerge release bump PR
4+
name: Automerge PRs from bots
55

66
on:
77
pull_request_target:
@@ -19,12 +19,12 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Autoapproving
22-
uses: hmarr/auto-approve-action@v2
22+
uses: hmarr/auto-approve-action@44888193675f29a83e04faf4002fa8c0b537b1e4 # v3.2.1 is used https://github.com/hmarr/auto-approve-action/releases/tag/v3.2.1
2323
with:
2424
github-token: "${{ secrets.GH_TOKEN_BOT_EVE }}"
2525

2626
- name: Label autoapproved
27-
uses: actions/github-script@v5
27+
uses: actions/github-script@v6
2828
with:
2929
github-token: ${{ secrets.GH_TOKEN }}
3030
script: |
@@ -41,7 +41,7 @@ jobs:
4141
runs-on: ubuntu-latest
4242
steps:
4343
- name: Automerging
44-
uses: pascalgn/automerge-action@v0.13.0
44+
uses: pascalgn/automerge-action@22948e0bc22f0aa673800da838595a3e7347e584 #v0.15.6 https://github.com/pascalgn/automerge-action/releases/tag/v0.15.6
4545
env:
4646
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
4747
GITHUB_LOGIN: asyncapi-bot

.github/workflows/bump.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
# This means we cannot extract easily latest version and have a risk that package is not yet on npm
1212
push:
1313
branches:
14-
- next-major
14+
- master
1515

1616
jobs:
1717
bump-in-dependent-projects:
@@ -32,5 +32,4 @@ jobs:
3232
committer_username: asyncapi-bot
3333
committer_email: [email protected]
3434
# html-template - temporary until react component releases 1.0, then it can be removed
35-
# all others - temporary until ParserJS releases 2.0, then it can be removed
36-
repos_to_ignore: html-template,generator,asyncapi-react,bundler,server-api,glee,tck,ts-nats-template,template-for-generator-templates,generator-filters,openapi-schema-parser,generator-hooks,raml-dt-schema-parser,dotnet-nats-template,cupid,generator-react-sdk,avro-schema-parser,optimizer,diff,simulator,dotnet-rabbitmq-template,go-watermill-template,markdown-template,java-template
35+
repos_to_ignore: html-template,cli,studio

.github/workflows/help-command.yml

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,48 @@ jobs:
1313
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions-ecosystem/action-create-comment@v1
16+
- name: Add comment to PR
17+
uses: actions/github-script@v6
1718
with:
18-
github_token: ${{ secrets.GH_TOKEN }}
19-
body: |
20-
Hello, @${{ github.actor }}! 👋🏼
19+
github-token: ${{ secrets.GH_TOKEN }}
20+
script: |
21+
//Yes to add comment to PR the same endpoint is use that we use to create a comment in issue
22+
//For more details http://developer.github.com/v3/issues/comments/
23+
//Also proved by this action https://github.com/actions-ecosystem/action-create-comment/blob/main/src/main.ts
24+
github.rest.issues.createComment({
25+
issue_number: context.issue.number,
26+
owner: context.repo.owner,
27+
repo: context.repo.repo,
28+
body: `Hello, @${{ github.actor }}! 👋🏼
29+
30+
I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
31+
32+
At the moment the following comments are supported in pull requests:
33+
34+
- `/ready-to-merge` or `/rtm` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added
35+
- `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
36+
- `/autoupdate` or `/au` - This comment will add `autoupdate` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.`
37+
})
2138

22-
I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
23-
24-
At the moment the following comments are supported in pull requests:
25-
26-
- `/ready-to-merge` or `/rtm` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added
27-
- `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
28-
- `/autoupdate` or `/au` - This comment will add `autoupdate` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.
2939
create_help_comment_issue:
3040
if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
3141
runs-on: ubuntu-latest
3242
steps:
33-
- uses: actions-ecosystem/action-create-comment@v1
43+
- name: Add comment to Issue
44+
uses: actions/github-script@v6
3445
with:
35-
github_token: ${{ secrets.GH_TOKEN }}
36-
body: |
37-
Hello, @${{ github.actor }}! 👋🏼
38-
39-
I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
40-
41-
At the moment the following comments are supported in issues:
42-
43-
- `/good-first-issue {js | ts | java | go | docs | design | ci-cd} ` or `/gfi {js | ts | java | go | docs | design | ci-cd} ` - label an issue as a `good first issue`.
44-
example: `/gfi js` or `/good-first-issue ci-cd`
46+
github-token: ${{ secrets.GH_TOKEN }}
47+
script: |
48+
github.rest.issues.createComment({
49+
issue_number: context.issue.number,
50+
owner: context.repo.owner,
51+
repo: context.repo.repo,
52+
body: `Hello, @${{ github.actor }}! 👋🏼
53+
54+
I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
55+
56+
At the moment the following comments are supported in issues:
57+
58+
- `/good-first-issue {js | ts | java | go | docs | design | ci-cd} ` or `/gfi {js | ts | java | go | docs | design | ci-cd} ` - label an issue as a `good first issue`.
59+
example: `/gfi js` or `/good-first-issue ci-cd`
60+
})

0 commit comments

Comments
 (0)