Skip to content

Commit 1408dbf

Browse files
authored
ci: update of files from global .github repo (#286)
1 parent c6fcefd commit 1408dbf

20 files changed

+219
-89
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ 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
3030
with:
3131
github-token: ${{ secrets.GH_TOKEN }}
3232
script: |
@@ -78,7 +78,7 @@ jobs:
7878
runs-on: ubuntu-latest
7979
steps:
8080
- name: Add do-not-merge label
81-
uses: actions/github-script@v6
81+
uses: actions/github-script@v7
8282
with:
8383
github-token: ${{ secrets.GH_TOKEN }}
8484
script: |
@@ -100,7 +100,7 @@ jobs:
100100
runs-on: ubuntu-latest
101101
steps:
102102
- name: Add autoupdate label
103-
uses: actions/github-script@v6
103+
uses: actions/github-script@v7
104104
with:
105105
github-token: ${{ secrets.GH_TOKEN }}
106106
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: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ 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
3736
with:
3837
github-token: ${{ secrets.GH_TOKEN }}
3938
script: |
@@ -59,8 +58,7 @@ jobs:
5958

6059
steps:
6160
- name: Add label `bounty`
62-
uses: actions/github-script@v6
63-
61+
uses: actions/github-script@v7
6462
with:
6563
github-token: ${{ secrets.GH_TOKEN }}
6664
script: |
@@ -101,8 +99,7 @@ jobs:
10199

102100
steps:
103101
- name: Remove label `bounty`
104-
uses: actions/github-script@v6
105-
102+
uses: actions/github-script@v7
106103
with:
107104
github-token: ${{ secrets.GH_TOKEN }}
108105
script: |

.github/workflows/bump.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout repo
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2424
- name: Check if Node.js project and has package.json
2525
id: packagejson
2626
run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT

.github/workflows/help-command.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ 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
1818
with:
1919
github-token: ${{ secrets.GH_TOKEN }}
2020
script: |
@@ -39,11 +39,11 @@ jobs:
3939
})
4040

4141
create_help_comment_issue:
42-
if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
42+
if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
4343
runs-on: ubuntu-latest
4444
steps:
4545
- name: Add comment to Issue
46-
uses: actions/github-script@v6
46+
uses: actions/github-script@v7
4747
with:
4848
github-token: ${{ secrets.GH_TOKEN }}
4949
script: |
@@ -58,5 +58,6 @@ jobs:
5858
At the moment the following comments are supported in issues:
5959

6060
- \`/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\``
61+
example: \`/gfi js\` or \`/good-first-issue ci-cd\`
62+
- \`/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\`.`
6263
})

.github/workflows/if-nodejs-pr-testing.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ jobs:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
1616
matrix:
17-
os: [ubuntu-latest, macos-latest, windows-latest]
17+
# Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner.
18+
# See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001
19+
os: [ubuntu-latest, macos-13, windows-latest]
1820
steps:
1921
- if: >
2022
!github.event.pull_request.draft && !(

.github/workflows/if-nodejs-release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ jobs:
3333
runs-on: ${{ matrix.os }}
3434
strategy:
3535
matrix:
36-
os: [ubuntu-latest, macos-latest, windows-latest]
36+
# Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner.
37+
# See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001
38+
os: [ubuntu-latest, macos-13, windows-latest]
3739
steps:
3840
- name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
3941
run: |
@@ -69,7 +71,7 @@ jobs:
6971
run: npm test --if-present
7072
- if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
7173
name: Report workflow run status to Slack
72-
uses: 8398a7/action-slack@v3
74+
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 #using https://github.com/8398a7/action-slack/releases/tag/v3.16.2
7375
with:
7476
status: ${{ job.status }}
7577
fields: repo,action,workflow
@@ -123,7 +125,7 @@ jobs:
123125
run: npx semantic-release@19.0.4
124126
- if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
125127
name: Report workflow run status to Slack
126-
uses: 8398a7/action-slack@v3
128+
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 #using https://github.com/8398a7/action-slack/releases/tag/v3.16.2
127129
with:
128130
status: ${{ job.status }}
129131
fields: repo,action,workflow

.github/workflows/if-nodejs-version-bump.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout repository
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919
with:
2020
# target branch of release. More info https://docs.github.com/en/rest/reference/repos#releases
2121
# in case release is created from release branch then we need to checkout from given branch
@@ -30,7 +30,7 @@ jobs:
3030
id: lockversion
3131
- if: steps.packagejson.outputs.exists == 'true'
3232
name: Setup Node.js
33-
uses: actions/setup-node@v3
33+
uses: actions/setup-node@v4
3434
with:
3535
node-version: "${{ steps.lockversion.outputs.version }}"
3636
cache: 'npm'
@@ -60,7 +60,7 @@ jobs:
6060
branch: version-bump/${{github.event.release.tag_name}}
6161
- if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
6262
name: Report workflow run status to Slack
63-
uses: 8398a7/action-slack@v3
63+
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 #using https://github.com/8398a7/action-slack/releases/tag/v3.16.2
6464
with:
6565
status: ${{ job.status }}
6666
fields: repo,action,workflow

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ jobs:
2020
name: Notify slack on every new issue
2121
runs-on: ubuntu-latest
2222
steps:
23-
- name: Checkout repository
24-
uses: actions/checkout@v3
2523
- name: Convert markdown to slack markdown for issue
2624
uses: asyncapi/.github/.github/actions/slackify-markdown@master
2725
id: issuemarkdown
2826
with:
2927
markdown: "[${{github.event.issue.title}}](${{github.event.issue.html_url}}) \n ${{github.event.issue.body}}"
3028
- name: Send info about issue
31-
uses: rtCamp/action-slack-notify@v2
29+
uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2
3230
env:
3331
SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}}
3432
SLACK_TITLE: 🐛 New Issue in ${{github.repository}} 🐛
@@ -40,15 +38,13 @@ jobs:
4038
name: Notify slack on every new pull request
4139
runs-on: ubuntu-latest
4240
steps:
43-
- name: Checkout repository
44-
uses: actions/checkout@v3
4541
- name: Convert markdown to slack markdown for pull request
4642
uses: asyncapi/.github/.github/actions/slackify-markdown@master
4743
id: prmarkdown
4844
with:
4945
markdown: "[${{github.event.pull_request.title}}](${{github.event.pull_request.html_url}}) \n ${{github.event.pull_request.body}}"
5046
- name: Send info about pull request
51-
uses: rtCamp/action-slack-notify@v2
47+
uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2
5248
env:
5349
SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}}
5450
SLACK_TITLE: 💪 New Pull Request in ${{github.repository}} 💪
@@ -60,15 +56,13 @@ jobs:
6056
name: Notify slack on every new pull request
6157
runs-on: ubuntu-latest
6258
steps:
63-
- name: Checkout repository
64-
uses: actions/checkout@v3
6559
- name: Convert markdown to slack markdown for pull request
6660
uses: asyncapi/.github/.github/actions/slackify-markdown@master
6761
id: discussionmarkdown
6862
with:
6963
markdown: "[${{github.event.discussion.title}}](${{github.event.discussion.html_url}}) \n ${{github.event.discussion.body}}"
7064
- name: Send info about pull request
71-
uses: rtCamp/action-slack-notify@v2
65+
uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2
7266
env:
7367
SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}}
7468
SLACK_TITLE: 💬 New Discussion in ${{github.repository}} 💬

0 commit comments

Comments
 (0)