Skip to content

Commit 2d58148

Browse files
authored
Merge branch 'master' into feature/add-transacion-to-kafka-bindings
2 parents d07c6cf + 9784b1e commit 2d58148

26 files changed

+747
-119
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Add label
18-
uses: actions/github-script@v6
18+
uses: actions/github-script@v7
1919
with:
2020
github-token: ${{ secrets.GH_TOKEN }}
2121
script: |

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Add ready-to-merge label
29-
uses: actions/github-script@v6
29+
uses: actions/github-script@v7
30+
env:
31+
GITHUB_ACTOR: ${{ github.actor }}
3032
with:
3133
github-token: ${{ secrets.GH_TOKEN }}
3234
script: |
@@ -56,7 +58,7 @@ jobs:
5658
issue_number: context.issue.number,
5759
owner: context.repo.owner,
5860
repo: context.repo.repo,
59-
body: `Hello, @${{ github.actor }}! 👋🏼
61+
body: `Hello, @${process.env.GITHUB_ACTOR}! 👋🏼
6062
This PR is not up to date with the base branch and can't be merged.
6163
Please update your branch manually with the latest version of the base branch.
6264
PRO-TIP: To request an update from the upstream branch, simply comment \`/u\` or \`/update\` and our bot will handle the update operation promptly.
@@ -78,7 +80,7 @@ jobs:
7880
runs-on: ubuntu-latest
7981
steps:
8082
- name: Add do-not-merge label
81-
uses: actions/github-script@v6
83+
uses: actions/github-script@v7
8284
with:
8385
github-token: ${{ secrets.GH_TOKEN }}
8486
script: |
@@ -100,7 +102,7 @@ jobs:
100102
runs-on: ubuntu-latest
101103
steps:
102104
- name: Add autoupdate label
103-
uses: actions/github-script@v6
105+
uses: actions/github-script@v7
104106
with:
105107
github-token: ${{ secrets.GH_TOKEN }}
106108
script: |

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

Lines changed: 66 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,75 @@ on:
1818

1919
jobs:
2020
automerge-for-humans:
21-
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
21+
# it runs only if PR actor is not a bot, at least not a bot that we know
22+
if: |
23+
github.event.pull_request.draft == false &&
24+
(github.event.pull_request.user.login != 'asyncapi-bot' ||
25+
github.event.pull_request.user.login != 'dependabot[bot]' ||
26+
github.event.pull_request.user.login != 'dependabot-preview[bot]')
2227
runs-on: ubuntu-latest
2328
steps:
24-
- name: Get list of authors
25-
uses: sergeysova/jq-action@v2
29+
- name: Get PR authors
2630
id: authors
31+
uses: actions/github-script@v7
2732
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
33+
script: |
34+
// Get paginated list of all commits in the PR
35+
try {
36+
const commitOpts = github.rest.pulls.listCommits.endpoint.merge({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
pull_number: context.issue.number
40+
});
41+
42+
const commits = await github.paginate(commitOpts);
43+
44+
if (commits.length === 0) {
45+
core.setFailed('No commits found in the PR');
46+
return '';
47+
}
48+
49+
// Get unique authors from the commits list
50+
const authors = commits.reduce((acc, commit) => {
51+
const username = commit.author?.login || commit.commit.author?.name;
52+
if (username && !acc[username]) {
53+
acc[username] = {
54+
name: commit.commit.author?.name,
55+
email: commit.commit.author?.email,
56+
}
57+
}
58+
59+
return acc;
60+
}, {});
61+
62+
return authors;
63+
} catch (error) {
64+
core.setFailed(error.message);
65+
return [];
66+
}
67+
68+
- name: Create commit message
69+
id: create-commit-message
70+
uses: actions/github-script@v7
71+
with:
72+
script: |
73+
const authors = ${{ steps.authors.outputs.result }};
74+
75+
if (Object.keys(authors).length === 0) {
76+
core.setFailed('No authors found in the PR');
77+
return '';
78+
}
79+
80+
// Create a string of the form "Co-authored-by: Name <email>"
81+
// ref: https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors
82+
const coAuthors = Object.values(authors).map(author => {
83+
return `Co-authored-by: ${author.name} <${author.email}>`;
84+
}).join('\n');
85+
86+
core.debug(coAuthors);;
87+
88+
return coAuthors;
89+
4590
- name: Automerge PR
4691
uses: pascalgn/automerge-action@22948e0bc22f0aa673800da838595a3e7347e584 #v0.15.6 https://github.com/pascalgn/automerge-action/releases/tag/v0.15.6
4792
env:
@@ -50,6 +95,6 @@ jobs:
5095
MERGE_METHOD: "squash"
5196
# Using the output of the previous step (`Co-authored-by: ...` lines) as commit description.
5297
# 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 }}"
98+
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})\n\n\n${{ fromJSON(steps.create-commit-message.outputs.result) }}"
5499
MERGE_RETRIES: "20"
55100
MERGE_RETRY_SLEEP: "30000"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Remove label
19-
uses: actions/github-script@v6
19+
uses: actions/github-script@v7
2020
with:
2121
github-token: ${{ secrets.GH_TOKEN }}
2222
script: |

.github/workflows/automerge-orphans.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout repository
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818
- name: Get list of orphans
19-
uses: actions/github-script@v6
19+
uses: actions/github-script@v7
2020
id: orphans
2121
with:
2222
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -58,7 +58,7 @@ jobs:
5858
markdown: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})"
5959
- if: steps.orphans.outputs.found == 'true'
6060
name: Send info about orphan to slack
61-
uses: rtCamp/action-slack-notify@v2
61+
uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2
6262
env:
6363
SLACK_WEBHOOK: ${{secrets.SLACK_CI_FAIL_NOTIFY}}
6464
SLACK_TITLE: 🚨 Not merged PR that should be automerged 🚨

.github/workflows/automerge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
github-token: "${{ secrets.GH_TOKEN_BOT_EVE }}"
2525

2626
- name: Label autoapproved
27-
uses: actions/github-script@v6
27+
uses: actions/github-script@v7
2828
with:
2929
github-token: ${{ secrets.GH_TOKEN }}
3030
script: |

.github/workflows/bounty-program-commands.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@ jobs:
3232

3333
steps:
3434
- name: ❌ @${{github.actor}} made an unauthorized attempt to use a Bounty Program's command
35-
uses: actions/github-script@v6
36-
35+
uses: actions/github-script@v7
36+
env:
37+
ACTOR: ${{ github.actor }}
3738
with:
3839
github-token: ${{ secrets.GH_TOKEN }}
3940
script: |
40-
const commentText = `❌ @${{github.actor}} is not authorized to use the Bounty Program's commands.
41+
const commentText = `❌ @${process.env.ACTOR} is not authorized to use the Bounty Program's commands.
4142
These commands can only be used by members of the [Bounty Team](https://github.com/orgs/asyncapi/teams/bounty_team).`;
4243
43-
console.log(`❌ @${{github.actor}} made an unauthorized attempt to use a Bounty Program's command.`);
44+
console.log(`❌ @${process.env.ACTOR} made an unauthorized attempt to use a Bounty Program's command.`);
4445
github.rest.issues.createComment({
4546
issue_number: context.issue.number,
4647
owner: context.repo.owner,
@@ -59,8 +60,7 @@ jobs:
5960

6061
steps:
6162
- name: Add label `bounty`
62-
uses: actions/github-script@v6
63-
63+
uses: actions/github-script@v7
6464
with:
6565
github-token: ${{ secrets.GH_TOKEN }}
6666
script: |
@@ -101,8 +101,7 @@ jobs:
101101

102102
steps:
103103
- name: Remove label `bounty`
104-
uses: actions/github-script@v6
105-
104+
uses: actions/github-script@v7
106105
with:
107106
github-token: ${{ secrets.GH_TOKEN }}
108107
script: |

.github/workflows/help-command.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ on:
1010

1111
jobs:
1212
create_help_comment_pr:
13-
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
13+
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Add comment to PR
17-
uses: actions/github-script@v6
17+
uses: actions/github-script@v7
18+
env:
19+
ACTOR: ${{ github.actor }}
1820
with:
1921
github-token: ${{ secrets.GH_TOKEN }}
2022
script: |
@@ -25,7 +27,7 @@ jobs:
2527
issue_number: context.issue.number,
2628
owner: context.repo.owner,
2729
repo: context.repo.repo,
28-
body: `Hello, @${{ github.actor }}! 👋🏼
30+
body: `Hello, @${process.env.ACTOR}! 👋🏼
2931
3032
I'm 🧞🧞🧞 Genie 🧞🧞🧞 from the magic lamp. Looks like somebody needs a hand!
3133
@@ -39,24 +41,27 @@ jobs:
3941
})
4042

4143
create_help_comment_issue:
42-
if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
44+
if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
4345
runs-on: ubuntu-latest
4446
steps:
4547
- name: Add comment to Issue
46-
uses: actions/github-script@v6
48+
uses: actions/github-script@v7
49+
env:
50+
ACTOR: ${{ github.actor }}
4751
with:
4852
github-token: ${{ secrets.GH_TOKEN }}
4953
script: |
5054
github.rest.issues.createComment({
5155
issue_number: context.issue.number,
5256
owner: context.repo.owner,
5357
repo: context.repo.repo,
54-
body: `Hello, @${{ github.actor }}! 👋🏼
58+
body: `Hello, @${process.env.ACTOR}! 👋🏼
5559
5660
I'm 🧞🧞🧞 Genie 🧞🧞🧞 from the magic lamp. Looks like somebody needs a hand!
5761
5862
At the moment the following comments are supported in issues:
5963

6064
- \`/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\`.
61-
example: \`/gfi js\` or \`/good-first-issue ci-cd\``
65+
example: \`/gfi js\` or \`/good-first-issue ci-cd\`
66+
- \`/transfer-issue {repo-name}\` or \`/ti {repo-name}\` - transfer issue from the source repository to the other repository passed by the user. example: \`/ti cli\` or \`/transfer-issue cli\`.`
6267
})

.github/workflows/issues-prs-notifications.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ jobs:
2323
- name: Convert markdown to slack markdown for issue
2424
uses: asyncapi/.github/.github/actions/slackify-markdown@master
2525
id: issuemarkdown
26+
env:
27+
ISSUE_TITLE: ${{github.event.issue.title}}
28+
ISSUE_URL: ${{github.event.issue.html_url}}
29+
ISSUE_BODY: ${{github.event.issue.body}}
2630
with:
27-
markdown: "[${{github.event.issue.title}}](${{github.event.issue.html_url}}) \n ${{github.event.issue.body}}"
31+
markdown: "[${{ env.ISSUE_TITLE }}](${{ env.ISSUE_URL }}) \n ${{ env.ISSUE_BODY }}"
2832
- name: Send info about issue
29-
uses: rtCamp/action-slack-notify@v2
33+
uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2
3034
env:
3135
SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}}
3236
SLACK_TITLE: 🐛 New Issue in ${{github.repository}} 🐛
@@ -41,10 +45,14 @@ jobs:
4145
- name: Convert markdown to slack markdown for pull request
4246
uses: asyncapi/.github/.github/actions/slackify-markdown@master
4347
id: prmarkdown
48+
env:
49+
PR_TITLE: ${{github.event.pull_request.title}}
50+
PR_URL: ${{github.event.pull_request.html_url}}
51+
PR_BODY: ${{github.event.pull_request.body}}
4452
with:
45-
markdown: "[${{github.event.pull_request.title}}](${{github.event.pull_request.html_url}}) \n ${{github.event.pull_request.body}}"
53+
markdown: "[${{ env.PR_TITLE }}](${{ env.PR_URL }}) \n ${{ env.PR_BODY }}"
4654
- name: Send info about pull request
47-
uses: rtCamp/action-slack-notify@v2
55+
uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2
4856
env:
4957
SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}}
5058
SLACK_TITLE: 💪 New Pull Request in ${{github.repository}} 💪
@@ -59,10 +67,14 @@ jobs:
5967
- name: Convert markdown to slack markdown for pull request
6068
uses: asyncapi/.github/.github/actions/slackify-markdown@master
6169
id: discussionmarkdown
70+
env:
71+
DISCUSSION_TITLE: ${{github.event.discussion.title}}
72+
DISCUSSION_URL: ${{github.event.discussion.html_url}}
73+
DISCUSSION_BODY: ${{github.event.discussion.body}}
6274
with:
63-
markdown: "[${{github.event.discussion.title}}](${{github.event.discussion.html_url}}) \n ${{github.event.discussion.body}}"
75+
markdown: "[${{ env.DISCUSSION_TITLE }}](${{ env.DISCUSSION_URL }}) \n ${{ env.DISCUSSION_BODY }}"
6476
- name: Send info about pull request
65-
uses: rtCamp/action-slack-notify@v2
77+
uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2
6678
env:
6779
SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}}
6880
SLACK_TITLE: 💬 New Discussion in ${{github.repository}} 💬

0 commit comments

Comments
 (0)