Skip to content

Commit 1a6958b

Browse files
authored
Merge pull request #999 from jonaslagoni/update_with_master_3
chore: update with master
2 parents 1a8c669 + 41686ae commit 1a6958b

Some content is hidden

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

43 files changed

+670
-982
lines changed

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

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +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';
3132
break;
3233
case 'markdown':
33-
values[1] = 'docs';
34+
area = 'docs';
3435
break;
3536
}
36-
if(values.length != 2 || !areas.includes(values[1])){
37+
if(!areas.includes(area)){
3738
const message = `Hey @${context.payload.sender.login}, your message doesn't follow the requirements, you can try \`/help\`.`
3839
3940
await github.rest.issues.createComment({
@@ -44,14 +45,14 @@ jobs:
4445
})
4546
} else {
4647
47-
//remove complexity and areas if there are any before adding new labels;
48+
// remove area if there is any before adding new labels.
4849
const currentLabels = (await github.rest.issues.listLabelsOnIssue({
4950
issue_number: context.issue.number,
5051
owner: context.repo.owner,
5152
repo: context.repo.repo,
5253
})).data.map(label => label.name);
5354
54-
const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(values[1])));
55+
const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(area)));
5556
shouldBeRemoved.forEach(label => {
5657
github.rest.issues.deleteLabel({
5758
owner: context.repo.owner,
@@ -60,11 +61,11 @@ jobs:
6061
});
6162
});
6263
63-
//add new labels
64+
// Add new labels.
6465
github.rest.issues.addLabels({
6566
issue_number: context.issue.number,
6667
owner: context.repo.owner,
6768
repo: context.repo.repo,
68-
labels: ['good first issue', `area/${values[1]}`]
69+
labels: ['good first issue', `area/${area}`]
6970
});
7071
}

.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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
| join("\n")'
4444
multiline: true
4545
- name: Automerge PR
46-
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
4747
env:
4848
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
4949
MERGE_LABELS: "!do-not-merge,ready-to-merge"

.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-action@v1.0.0
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: 5 additions & 5 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,11 +41,11 @@ 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
48-
MERGE_LABELS: ""
48+
MERGE_LABELS: "!do-not-merge"
4949
MERGE_METHOD: "squash"
5050
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})"
5151
MERGE_RETRIES: "20"

.github/workflows/bump.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.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)