Skip to content

Commit

Permalink
Merge pull request #787 from fmvilas/merge-master-into-next-major-spec
Browse files Browse the repository at this point in the history
chore: merge master into next major spec
  • Loading branch information
fmvilas authored Jun 13, 2023
2 parents b59983c + 1def5f7 commit f551deb
Show file tree
Hide file tree
Showing 291 changed files with 19,598 additions and 28,121 deletions.
5 changes: 3 additions & 2 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/16149591?v=4",
"profile": "https://github.com/aeworxet",
"contributions": [
"test"
"test",
"code"
]
},
{
Expand Down Expand Up @@ -182,5 +183,5 @@
}
],
"contributorsPerLine": 4,
"skipCi": true
"skipCi": false
}
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ env:
node: true
es6: true
jest: true
mocha: true
browser: true

plugins:
- "@typescript-eslint"
Expand Down
37 changes: 20 additions & 17 deletions .github/workflows/add-good-first-issue-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,37 @@
# Purpose of this workflow is to enable anyone to label issue with 'Good First Issue' and 'area/*' with a single command.
name: Add 'Good First Issue' and 'area/*' labels # if proper comment added

on:
issue_comment:
types:
- created
on:
issue_comment:
types:
- created

jobs:
add-labels:
if: ${{!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot'}}
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' ))}}
runs-on: ubuntu-latest
steps:
- name: Add label
if: contains(github.event.comment.body, '/good-first-issue') || contains(github.event.comment.body, '/gfi' )
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const areas = ['javascript', 'typescript', 'java' , 'go', 'docs', 'ci-cd', 'design'];
const values = context.payload.comment.body.trim().split(" ");
switch(values[1]){
const words = context.payload.comment.body.trim().split(" ");
const areaIndex = words.findIndex((word)=> word === '/gfi' || word === '/good-first-issue') + 1
let area = words[areaIndex];
switch(area){
case 'ts':
values[1] = 'typescript';
area = 'typescript';
break;
case 'js':
values[1] = 'javascript';
area = 'javascript';
break;
case 'markdown':
values[1] = 'docs';
area = 'docs';
break;
}
if(values.length != 2 || !areas.includes(values[1])){
if(!areas.includes(area)){
const message = `Hey @${context.payload.sender.login}, your message doesn't follow the requirements, you can try \`/help\`.`
await github.rest.issues.createComment({
Expand All @@ -42,14 +45,14 @@ jobs:
})
} else {
//remove complexity and areas if there are any before adding new labels;
// remove area if there is any before adding new labels.
const currentLabels = (await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
})).data.map(label => label.name);
const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(values[1])));
const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(area)));
shouldBeRemoved.forEach(label => {
github.rest.issues.deleteLabel({
owner: context.repo.owner,
Expand All @@ -58,11 +61,11 @@ jobs:
});
});
//add new labels
// Add new labels.
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['good first issue', `area/${values[1]}`]
labels: ['good first issue', `area/${area}`]
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

name: Label PRs # if proper comment added

on:
issue_comment:
types:
- created
on:
issue_comment:
types:
- created

jobs:
add-ready-to-merge-label:
if: >
if: >
github.event.issue.pull_request &&
github.event.issue.state != 'closed' &&
github.actor != 'asyncapi-bot' &&
Expand All @@ -25,9 +25,8 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Add ready-to-merge label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand Down Expand Up @@ -64,7 +63,7 @@ jobs:
Thanks 😄`
})
}
add-do-not-merge-label:
if: >
github.event.issue.pull_request &&
Expand All @@ -77,7 +76,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add do-not-merge label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand All @@ -86,7 +85,7 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['do-not-merge']
})
})
add-autoupdate-label:
if: >
github.event.issue.pull_request &&
Expand All @@ -99,7 +98,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add autoupdate label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand All @@ -108,4 +107,4 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['autoupdate']
})
})
29 changes: 26 additions & 3 deletions .github/workflows/automerge-for-humans-merging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,35 @@ jobs:
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
runs-on: ubuntu-latest
steps:
- name: Get list of authors
uses: sergeysova/jq-action@v2
id: authors
with:
# This cmd does following (line by line):
# 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.
# 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.
# 3. Grabs the data we need for adding the `Co-authored-by: ...` lines later and puts it into objects to be used later on.
# 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.
# 5. Removes repeated authors (authors can have more than one commit in the PR).
# 6. Builds the `Co-authored-by: ...` lines with actual info.
# 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).
cmd: |
curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" "${{github.event.pull_request._links.commits.href}}?per_page=100" |
jq -r '[.[]
| {name: .commit.author.name, email: .commit.author.email, login: .author.login}]
| map(select(.login != "${{github.event.pull_request.user.login}}"))
| unique
| map("Co-authored-by: " + .name + " <" + .email + ">")
| join("\n")'
multiline: true
- name: Automerge PR
uses: pascalgn/automerge-action@v0.14.3
uses: pascalgn/automerge-action@22948e0bc22f0aa673800da838595a3e7347e584 #v0.15.6 https://github.com/pascalgn/automerge-action/releases/tag/v0.15.6
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
MERGE_LABELS: "!do-not-merge,ready-to-merge"
MERGE_METHOD: "squash"
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})"
# Using the output of the previous step (`Co-authored-by: ...` lines) as commit description.
# 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
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})\n\n\n${{ steps.authors.outputs.value }}"
MERGE_RETRIES: "20"
MERGE_RETRY_SLEEP: "30000"
MERGE_RETRY_SLEEP: "30000"
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Remove label
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const labelToRemove = 'ready-to-merge';
const labels = context.payload.pull_request.labels;
const isLabelPresent = labels.some(label => label.name === labelToRemove)
if(!isLabelPresent) return;
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: labelToRemove
})
})
8 changes: 5 additions & 3 deletions .github/workflows/automerge-orphans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ jobs:
name: Find orphans and notify
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get list of orphans
uses: actions/github-script@v3
uses: actions/github-script@v6
id: orphans
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -50,10 +52,10 @@ jobs:
}
- if: steps.orphans.outputs.found == 'true'
name: Convert markdown to slack markdown
uses: LoveToKnow/slackify-markdown[email protected]
uses: asyncapi/.github/.github/actions/slackify-markdown@master
id: issuemarkdown
with:
text: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})"
markdown: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})"
- if: steps.orphans.outputs.found == 'true'
name: Send info about orphan to slack
uses: rtCamp/action-slack-notify@v2
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This action is centrally managed in https://github.com/asyncapi/.github/
# 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.

name: Automerge release bump PR
name: Automerge PRs from bots

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

- name: Label autoapproved
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
Expand All @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Automerging
uses: pascalgn/automerge-action@v0.13.0
uses: pascalgn/automerge-action@22948e0bc22f0aa673800da838595a3e7347e584 #v0.15.6 https://github.com/pascalgn/automerge-action/releases/tag/v0.15.6
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
GITHUB_LOGIN: asyncapi-bot
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Check if Node.js project and has package.json
id: packagejson
run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
- if: steps.packagejson.outputs.exists == 'true'
name: Bumping latest version of this package in other repositories
uses: derberg/npm-dependency-manager-for-your-github-org@v4
uses: derberg/npm-dependency-manager-for-your-github-org@26a4f13d740254719971325046822a169aaa7441 # using v5.-.- https://github.com/derberg/npm-dependency-manager-for-your-github-org/releases/tag/v5.0.0
with:
github_token: ${{ secrets.GH_TOKEN }}
committer_username: asyncapi-bot
committer_email: [email protected]
repos_to_ignore: html-template # this is temporary until react component releases 1.0, then it can be removed
repos_to_ignore: html-template # this is temporary until react component releases 1.0, then it can be removed
60 changes: 38 additions & 22 deletions .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,48 @@ jobs:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-create-comment@v1
- name: Add comment to PR
uses: actions/github-script@v6
with:
github_token: ${{ secrets.GH_TOKEN }}
body: |
Hello, @${{ github.actor }}! 👋🏼
github-token: ${{ secrets.GH_TOKEN }}
script: |
//Yes to add comment to PR the same endpoint is use that we use to create a comment in issue
//For more details http://developer.github.com/v3/issues/comments/
//Also proved by this action https://github.com/actions-ecosystem/action-create-comment/blob/main/src/main.ts
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Hello, @${{ github.actor }}! 👋🏼
I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
At the moment the following comments are supported in pull requests:

- `/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
- `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
- `/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.`
})

I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
At the moment the following comments are supported in pull requests:
- `/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
- `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
- `/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.
create_help_comment_issue:
if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-create-comment@v1
- name: Add comment to Issue
uses: actions/github-script@v6
with:
github_token: ${{ secrets.GH_TOKEN }}
body: |
Hello, @${{ github.actor }}! 👋🏼
I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
At the moment the following comments are supported in issues:
- `/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`.
example: `/gfi js` or `/good-first-issue ci-cd`
github-token: ${{ secrets.GH_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Hello, @${{ github.actor }}! 👋🏼
I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
At the moment the following comments are supported in issues:

- `/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`.
example: `/gfi js` or `/good-first-issue ci-cd`
})
Loading

0 comments on commit f551deb

Please sign in to comment.