@asyncapi/converter 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml +54 -0
- package/.github/workflows/automerge-for-humans-merging.yml +32 -0
- package/.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml +35 -0
- package/.github/workflows/automerge.yml +19 -7
- package/.github/workflows/autoupdate.yml +28 -0
- package/.github/workflows/help-command.yml +28 -0
- package/.github/workflows/if-nodejs-pr-testing.yml +7 -1
- package/.github/workflows/if-nodejs-release.yml +12 -2
- package/.github/workflows/issues-prs-notifications.yml +1 -1
- package/.github/workflows/stale-issues-prs.yml +21 -9
- package/.github/workflows/welcome-first-time-contrib.yml +78 -29
- package/CODEOWNERS +8 -0
- package/lib/index.js +10 -9
- package/package.json +11 -11
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#This workflow is centrally managed in https://github.com/asyncapi/.github/
|
|
2
|
+
#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
|
|
3
|
+
|
|
4
|
+
#Purpose of this workflow is to enable anyone to label PR with `ready-to-merge` and `do-not-merge` labels to get stuff merged or blocked from merging
|
|
5
|
+
name: Add ready-to-merge or do-not-merge label # if proper comment added
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
issue_comment:
|
|
9
|
+
types:
|
|
10
|
+
- created
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
parse-comment-and-add-ready: # for handling cases when you want to mark as ready to merge
|
|
14
|
+
if: github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot'
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: Check if PR is draft # such info is not available in the context of issue_comment event
|
|
18
|
+
uses: actions/github-script@v5
|
|
19
|
+
id: checkDraft
|
|
20
|
+
with:
|
|
21
|
+
result-encoding: string
|
|
22
|
+
script: |
|
|
23
|
+
const prDetailsUrl = context.payload.issue.pull_request.url;
|
|
24
|
+
const response = await github.request(prDetailsUrl);
|
|
25
|
+
return response.data.draft;
|
|
26
|
+
- name: Add label
|
|
27
|
+
if: steps.checkDraft.outputs.result == 'false' && (contains(github.event.comment.body, '/ready-to-merge') || contains(github.event.comment.body, '/rtm' ))
|
|
28
|
+
uses: actions/github-script@v5
|
|
29
|
+
with:
|
|
30
|
+
github-token: ${{ secrets.GH_TOKEN }}
|
|
31
|
+
script: |
|
|
32
|
+
github.rest.issues.addLabels({
|
|
33
|
+
issue_number: context.issue.number,
|
|
34
|
+
owner: context.repo.owner,
|
|
35
|
+
repo: context.repo.repo,
|
|
36
|
+
labels: ['ready-to-merge']
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
parse-comment-and-add-block: # for handling cases when you want to mark as do-not-merge
|
|
40
|
+
if: github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot'
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
steps:
|
|
43
|
+
- name: Add label
|
|
44
|
+
if: contains(github.event.comment.body, '/do-not-merge') || contains(github.event.comment.body, '/dnm' )
|
|
45
|
+
uses: actions/github-script@v5
|
|
46
|
+
with:
|
|
47
|
+
github-token: ${{ secrets.GH_TOKEN }}
|
|
48
|
+
script: |
|
|
49
|
+
github.rest.issues.addLabels({
|
|
50
|
+
issue_number: context.issue.number,
|
|
51
|
+
owner: context.repo.owner,
|
|
52
|
+
repo: context.repo.repo,
|
|
53
|
+
labels: ['do-not-merge']
|
|
54
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#This workflow is centrally managed in https://github.com/asyncapi/.github/
|
|
2
|
+
#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
|
|
3
|
+
|
|
4
|
+
#Purpose of this workflow is to allow people to merge PR without a need of maintainer doing it. If all checks are in place (including maintainers approval) - JUST MERGE IT!
|
|
5
|
+
name: Automerge For Humans
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
pull_request_target:
|
|
9
|
+
types:
|
|
10
|
+
- labeled
|
|
11
|
+
- unlabeled
|
|
12
|
+
- synchronize
|
|
13
|
+
- opened
|
|
14
|
+
- edited
|
|
15
|
+
- ready_for_review
|
|
16
|
+
- reopened
|
|
17
|
+
- unlocked
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
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
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- name: Automerge PR
|
|
25
|
+
uses: pascalgn/automerge-action@v0.14.3
|
|
26
|
+
env:
|
|
27
|
+
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
|
|
28
|
+
MERGE_LABELS: "!do-not-merge,ready-to-merge"
|
|
29
|
+
MERGE_METHOD: "squash"
|
|
30
|
+
MERGE_COMMIT_MESSAGE: "pull-request-title"
|
|
31
|
+
MERGE_RETRIES: "20"
|
|
32
|
+
MERGE_RETRY_SLEEP: "30000"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#This workflow is centrally managed in https://github.com/asyncapi/.github/
|
|
2
|
+
#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
|
|
3
|
+
|
|
4
|
+
# Defence from evil contributor that after adding `ready-to-merge` all suddenly makes evil commit or evil change in PR title
|
|
5
|
+
# Label is removed once above action is detected
|
|
6
|
+
name: Remove ready-to-merge label
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
pull_request_target:
|
|
10
|
+
types:
|
|
11
|
+
- synchronize
|
|
12
|
+
- edited
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
remove-ready-label:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- name: Remove label
|
|
19
|
+
uses: actions/github-script@v5
|
|
20
|
+
with:
|
|
21
|
+
github-token: ${{ secrets.GH_TOKEN }}
|
|
22
|
+
script: |
|
|
23
|
+
const labelToRemove = 'ready-to-merge';
|
|
24
|
+
const labels = context.payload.pull_request.labels;
|
|
25
|
+
|
|
26
|
+
const isLabelPresent = labels.some(label => label.name === labelToRemove)
|
|
27
|
+
|
|
28
|
+
if(!isLabelPresent) return;
|
|
29
|
+
|
|
30
|
+
github.rest.issues.removeLabel({
|
|
31
|
+
issue_number: context.issue.number,
|
|
32
|
+
owner: context.repo.owner,
|
|
33
|
+
repo: context.repo.repo,
|
|
34
|
+
name: labelToRemove
|
|
35
|
+
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#This action is centrally managed in https://github.com/asyncapi/.github/
|
|
2
|
-
#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
|
|
1
|
+
# This action is centrally managed in https://github.com/asyncapi/.github/
|
|
2
|
+
# 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.
|
|
3
3
|
|
|
4
4
|
name: Automerge release bump PR
|
|
5
5
|
|
|
@@ -17,26 +17,38 @@ on:
|
|
|
17
17
|
pull_request_review:
|
|
18
18
|
types:
|
|
19
19
|
- submitted
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
jobs:
|
|
22
22
|
|
|
23
23
|
autoapprove:
|
|
24
|
-
if: github.event.pull_request.draft == false
|
|
24
|
+
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]') && !contains(github.event.pull_request.labels.*.name, 'released')
|
|
25
25
|
runs-on: ubuntu-latest
|
|
26
26
|
steps:
|
|
27
27
|
- name: Autoapproving
|
|
28
28
|
uses: hmarr/auto-approve-action@v2
|
|
29
|
-
if: github.actor == ('asyncapi-bot' || github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]') && !contains(github.event.pull_request.labels.*.name, 'released')
|
|
30
29
|
with:
|
|
31
30
|
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
32
31
|
|
|
32
|
+
- name: Label autoapproved
|
|
33
|
+
uses: actions/github-script@v5
|
|
34
|
+
with:
|
|
35
|
+
github-token: ${{ secrets.GH_TOKEN }}
|
|
36
|
+
script: |
|
|
37
|
+
github.rest.issues.addLabels({
|
|
38
|
+
issue_number: context.issue.number,
|
|
39
|
+
owner: context.repo.owner,
|
|
40
|
+
repo: context.repo.repo,
|
|
41
|
+
labels: ['autoapproved']
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
|
|
33
45
|
automerge:
|
|
34
46
|
needs: [autoapprove]
|
|
47
|
+
if: 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]'
|
|
35
48
|
runs-on: ubuntu-latest
|
|
36
49
|
steps:
|
|
37
50
|
- name: Automerging
|
|
38
51
|
uses: pascalgn/automerge-action@v0.13.0
|
|
39
|
-
if: github.actor == 'asyncapi-bot' || github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
|
|
40
52
|
env:
|
|
41
53
|
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
|
|
42
54
|
GITHUB_LOGIN: asyncapi-bot
|
|
@@ -44,4 +56,4 @@ jobs:
|
|
|
44
56
|
MERGE_METHOD: "squash"
|
|
45
57
|
MERGE_COMMIT_MESSAGE: "pull-request-title"
|
|
46
58
|
MERGE_RETRIES: "20"
|
|
47
|
-
MERGE_RETRY_SLEEP: "30000"
|
|
59
|
+
MERGE_RETRY_SLEEP: "30000"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#This action is centrally managed in https://github.com/asyncapi/.github/
|
|
2
|
+
#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
|
|
3
|
+
|
|
4
|
+
#This workflow is designed to work with:
|
|
5
|
+
# - autoapprove and automerge workflows for dependabot and asyncapibot.
|
|
6
|
+
# - special release branches that we from time to time create in upstream repos. If we open up PRs for them from the very beginning of the release, the release branch will constantly update with new things from the destination branch they are opened against
|
|
7
|
+
|
|
8
|
+
# It uses GitHub Action that auto-updates pull requests branches, whenever changes are pushed to their destination branch.
|
|
9
|
+
#Autoupdating to latest destination branch works only in the context of upstream repo and not forks
|
|
10
|
+
|
|
11
|
+
name: autoupdate
|
|
12
|
+
|
|
13
|
+
on:
|
|
14
|
+
push: {}
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
|
|
18
|
+
autoupdate:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- name: Autoupdating
|
|
22
|
+
uses: docker://chinthakagodawita/autoupdate-action:v1
|
|
23
|
+
env:
|
|
24
|
+
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
|
25
|
+
PR_FILTER: "labelled"
|
|
26
|
+
PR_LABELS: "autoapproved"
|
|
27
|
+
PR_READY_STATE: "ready_for_review"
|
|
28
|
+
MERGE_CONFLICT_ACTION: "ignore"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#This workflow is centrally managed in https://github.com/asyncapi/.github/
|
|
2
|
+
#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
|
|
3
|
+
|
|
4
|
+
name: Create help comment
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
issue_comment:
|
|
8
|
+
types:
|
|
9
|
+
- created
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
create_help_comment:
|
|
13
|
+
if: github.event.issue.pull_request
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions-ecosystem/action-create-comment@v1
|
|
17
|
+
if: contains(github.event.comment.body, '/help')
|
|
18
|
+
with:
|
|
19
|
+
github_token: ${{ secrets.GH_TOKEN }}
|
|
20
|
+
body: |
|
|
21
|
+
Hello, @${{ github.actor }}! 👋🏼
|
|
22
|
+
|
|
23
|
+
I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
|
|
24
|
+
|
|
25
|
+
At the moment the following comments are supported in pull requests:
|
|
26
|
+
|
|
27
|
+
- `/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
|
|
28
|
+
- `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
|
|
@@ -16,6 +16,10 @@ jobs:
|
|
|
16
16
|
matrix:
|
|
17
17
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
18
18
|
steps:
|
|
19
|
+
- name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
|
|
20
|
+
run: |
|
|
21
|
+
git config --global core.autocrlf false
|
|
22
|
+
git config --global core.eol lf
|
|
19
23
|
- name: Checkout repository
|
|
20
24
|
uses: actions/checkout@v2
|
|
21
25
|
- name: Check if Node.js project and has package.json
|
|
@@ -24,9 +28,11 @@ jobs:
|
|
|
24
28
|
shell: bash
|
|
25
29
|
- if: steps.packagejson.outputs.exists == 'true'
|
|
26
30
|
name: Setup Node.js
|
|
27
|
-
uses: actions/setup-node@
|
|
31
|
+
uses: actions/setup-node@v2
|
|
28
32
|
with:
|
|
29
33
|
node-version: 14
|
|
34
|
+
cache: 'npm'
|
|
35
|
+
cache-dependency-path: '**/package-lock.json'
|
|
30
36
|
- if: steps.packagejson.outputs.exists == 'true'
|
|
31
37
|
name: Install dependencies
|
|
32
38
|
id: first-installation
|
|
@@ -21,6 +21,10 @@ jobs:
|
|
|
21
21
|
matrix:
|
|
22
22
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
23
23
|
steps:
|
|
24
|
+
- name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
|
|
25
|
+
run: |
|
|
26
|
+
git config --global core.autocrlf false
|
|
27
|
+
git config --global core.eol lf
|
|
24
28
|
- name: Checkout repository
|
|
25
29
|
uses: actions/checkout@v2
|
|
26
30
|
- name: Check if Node.js project and has package.json
|
|
@@ -29,9 +33,11 @@ jobs:
|
|
|
29
33
|
shell: bash
|
|
30
34
|
- if: steps.packagejson.outputs.exists == 'true'
|
|
31
35
|
name: Setup Node.js
|
|
32
|
-
uses: actions/setup-node@
|
|
36
|
+
uses: actions/setup-node@v2
|
|
33
37
|
with:
|
|
34
38
|
node-version: 14
|
|
39
|
+
cache: 'npm'
|
|
40
|
+
cache-dependency-path: '**/package-lock.json'
|
|
35
41
|
- if: steps.packagejson.outputs.exists == 'true'
|
|
36
42
|
name: Install dependencies
|
|
37
43
|
run: npm install
|
|
@@ -44,6 +50,10 @@ jobs:
|
|
|
44
50
|
name: Publish to NPM and GitHub
|
|
45
51
|
runs-on: ubuntu-latest
|
|
46
52
|
steps:
|
|
53
|
+
- name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
|
|
54
|
+
run: |
|
|
55
|
+
git config --global core.autocrlf false
|
|
56
|
+
git config --global core.eol lf
|
|
47
57
|
- name: Checkout repository
|
|
48
58
|
uses: actions/checkout@v2
|
|
49
59
|
- name: Check if Node.js project and has package.json
|
|
@@ -67,4 +77,4 @@ jobs:
|
|
|
67
77
|
GIT_AUTHOR_EMAIL: info@asyncapi.io
|
|
68
78
|
GIT_COMMITTER_NAME: asyncapi-bot
|
|
69
79
|
GIT_COMMITTER_EMAIL: info@asyncapi.io
|
|
70
|
-
run: npm run release
|
|
80
|
+
run: npm run release
|
|
@@ -11,20 +11,32 @@ jobs:
|
|
|
11
11
|
stale:
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
steps:
|
|
14
|
-
- uses: actions/stale@
|
|
14
|
+
- uses: actions/stale@v4.0.0
|
|
15
15
|
with:
|
|
16
16
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
17
17
|
stale-issue-message: |
|
|
18
18
|
This issue has been automatically marked as stale because it has not had recent activity :sleeping:
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
|
|
20
|
+
It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.
|
|
21
|
+
|
|
22
|
+
There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under [open governance model](https://github.com/asyncapi/community/blob/master/CHARTER.md).
|
|
23
|
+
|
|
24
|
+
Let us figure out together how to push this issue forward. Connect with us through [one of many communication channels](https://github.com/asyncapi/community/issues/1) we established here.
|
|
25
|
+
|
|
26
|
+
Thank you for your patience :heart:
|
|
21
27
|
stale-pr-message: |
|
|
22
28
|
This pull request has been automatically marked as stale because it has not had recent activity :sleeping:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
|
|
30
|
+
It will be closed in 120 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation.
|
|
31
|
+
|
|
32
|
+
There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under [open governance model](https://github.com/asyncapi/community/blob/master/CHARTER.md).
|
|
33
|
+
|
|
34
|
+
Let us figure out together how to push this pull request forward. Connect with us through [one of many communication channels](https://github.com/asyncapi/community/issues/1) we established here.
|
|
35
|
+
|
|
36
|
+
Thank you for your patience :heart:
|
|
37
|
+
days-before-stale: 120
|
|
38
|
+
days-before-close: 120
|
|
27
39
|
stale-issue-label: stale
|
|
28
40
|
stale-pr-label: stale
|
|
29
|
-
exempt-issue-
|
|
30
|
-
exempt-pr-
|
|
41
|
+
exempt-issue-labels: keep-open
|
|
42
|
+
exempt-pr-labels: keep-open
|
|
@@ -1,34 +1,83 @@
|
|
|
1
1
|
#This action is centrally managed in https://github.com/asyncapi/.github/
|
|
2
2
|
#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
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
#disabled because of https://github.com/asyncapi/.github/issues/73
|
|
6
|
-
#########
|
|
4
|
+
name: Welcome first time contributors
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
on:
|
|
7
|
+
pull_request_target:
|
|
8
|
+
types:
|
|
9
|
+
- opened
|
|
10
|
+
issues:
|
|
11
|
+
types:
|
|
12
|
+
- opened
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
14
|
+
jobs:
|
|
15
|
+
welcome:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/github-script@v3
|
|
19
|
+
with:
|
|
20
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
21
|
+
script: |
|
|
22
|
+
const issueMessage = `Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our [contributors guide](https://github.com/asyncapi/community/blob/master/CONTRIBUTING.md) and the instructions about a [basic recommended setup](https://github.com/asyncapi/.github/blob/master/git-workflow.md) useful for opening a pull request.<br />Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out [this issue](https://github.com/asyncapi/asyncapi/issues/115).`;
|
|
23
|
+
const prMessage = `Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our [contributors guide](https://github.com/asyncapi/community/blob/master/CONTRIBUTING.md) useful for opening a pull request.<br />Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out [this issue](https://github.com/asyncapi/asyncapi/issues/115).`;
|
|
24
|
+
if (!issueMessage && !prMessage) {
|
|
25
|
+
throw new Error('Action must have at least one of issue-message or pr-message set');
|
|
26
|
+
}
|
|
27
|
+
const isIssue = !!context.payload.issue;
|
|
28
|
+
let isFirstContribution;
|
|
29
|
+
if (isIssue) {
|
|
30
|
+
const query = `query($owner:String!, $name:String!, $contributer:String!) {
|
|
31
|
+
repository(owner:$owner, name:$name){
|
|
32
|
+
issues(first: 1, filterBy: {createdBy:$contributer}){
|
|
33
|
+
totalCount
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}`;
|
|
37
|
+
const variables = {
|
|
38
|
+
owner: context.repo.owner,
|
|
39
|
+
name: context.repo.repo,
|
|
40
|
+
contributer: context.payload.sender.login
|
|
41
|
+
};
|
|
42
|
+
const { repository: { issues: { totalCount } } } = await github.graphql(query, variables);
|
|
43
|
+
isFirstContribution = totalCount === 1;
|
|
44
|
+
} else {
|
|
45
|
+
const query = `query($qstr: String!) {
|
|
46
|
+
search(query: $qstr, type: ISSUE, first: 1) {
|
|
47
|
+
issueCount
|
|
48
|
+
}
|
|
49
|
+
}`;
|
|
50
|
+
const variables = {
|
|
51
|
+
"qstr": `repo:${context.repo.owner}/${context.repo.repo} type:pr author:${context.payload.sender.login}`,
|
|
52
|
+
};
|
|
53
|
+
const { search: { issueCount } } = await github.graphql(query, variables);
|
|
54
|
+
isFirstContribution = issueCount === 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!isFirstContribution) {
|
|
58
|
+
console.log(`Not the users first contribution.`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const message = isIssue ? issueMessage : prMessage;
|
|
62
|
+
// Add a comment to the appropriate place
|
|
63
|
+
if (isIssue) {
|
|
64
|
+
const issueNumber = context.payload.issue.number;
|
|
65
|
+
console.log(`Adding message: ${message} to issue #${issueNumber}`);
|
|
66
|
+
await github.issues.createComment({
|
|
67
|
+
owner: context.payload.repository.owner.login,
|
|
68
|
+
repo: context.payload.repository.name,
|
|
69
|
+
issue_number: issueNumber,
|
|
70
|
+
body: message
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
const pullNumber = context.payload.pull_request.number;
|
|
75
|
+
console.log(`Adding message: ${message} to pull request #${pullNumber}`);
|
|
76
|
+
await github.pulls.createReview({
|
|
77
|
+
owner: context.payload.repository.owner.login,
|
|
78
|
+
repo: context.payload.repository.name,
|
|
79
|
+
pull_number: pullNumber,
|
|
80
|
+
body: message,
|
|
81
|
+
event: 'COMMENT'
|
|
82
|
+
});
|
|
83
|
+
}
|
package/CODEOWNERS
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This file provides an overview of code owners in this repository.
|
|
2
|
+
|
|
3
|
+
# Each line is a file pattern followed by one or more owners.
|
|
4
|
+
# The last matching pattern has the most precedence.
|
|
5
|
+
# For more details, read the following article on GitHub: https://help.github.com/articles/about-codeowners/.
|
|
6
|
+
|
|
7
|
+
# The default owners are automatically added as reviewers when you open a pull request unless different owners are specified in the file.
|
|
8
|
+
* @fmvilas @magicmatatjahu @derberg @github-actions[bot]
|
package/lib/index.js
CHANGED
|
@@ -72,12 +72,12 @@ function from__1_2_0__to__2_0_0_rc1(asyncapi1, options) { // NOSONAR
|
|
|
72
72
|
|
|
73
73
|
result.asyncapi = '2.0.0-rc1';
|
|
74
74
|
result.id = options.id || `urn:${asyncapi1.info.title.toLowerCase().split(' ').join('.')}`;
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
if (asyncapi1.servers) {
|
|
77
77
|
const security = asyncapi1.security;
|
|
78
78
|
result.servers = asyncapi1.servers.map(server => {
|
|
79
79
|
const { scheme, schemeVersion, ...rest } = server;
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
const out = {
|
|
82
82
|
...rest,
|
|
83
83
|
...{
|
|
@@ -94,9 +94,10 @@ function from__1_2_0__to__2_0_0_rc1(asyncapi1, options) { // NOSONAR
|
|
|
94
94
|
return out;
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
if (asyncapi1.topics) {
|
|
99
|
-
|
|
99
|
+
const baseTopic = asyncapi1.baseTopic ? `${asyncapi1.baseTopic}.` : "";
|
|
100
|
+
result.channels = _.mapKeys(result.topics, (__, topicName) => dotsToSlashes(`${baseTopic}${topicName}`));
|
|
100
101
|
_.map(result.channels, ch => {
|
|
101
102
|
if (ch.publish) {
|
|
102
103
|
ch.publish = { message: ch.publish };
|
|
@@ -114,7 +115,7 @@ function from__1_2_0__to__2_0_0_rc1(asyncapi1, options) { // NOSONAR
|
|
|
114
115
|
'/': eventToChannel(asyncapi1.events),
|
|
115
116
|
};
|
|
116
117
|
}
|
|
117
|
-
|
|
118
|
+
|
|
118
119
|
delete result.topics;
|
|
119
120
|
delete result.stream;
|
|
120
121
|
delete result.events;
|
|
@@ -129,7 +130,7 @@ function from__2_0_0_rc1__to__2_0_0_rc2(asyncapi2rc1, options) { // NOSONAR
|
|
|
129
130
|
|
|
130
131
|
result.asyncapi = '2.0.0-rc2';
|
|
131
132
|
result.id = result.id || options.id;
|
|
132
|
-
|
|
133
|
+
|
|
133
134
|
if (asyncapi2rc1.servers) {
|
|
134
135
|
const serverMap = {};
|
|
135
136
|
asyncapi2rc1.servers.forEach((server, index) => {
|
|
@@ -139,7 +140,7 @@ function from__2_0_0_rc1__to__2_0_0_rc2(asyncapi2rc1, options) { // NOSONAR
|
|
|
139
140
|
});
|
|
140
141
|
result.servers = serverMap;
|
|
141
142
|
}
|
|
142
|
-
|
|
143
|
+
|
|
143
144
|
if (result.channels) {
|
|
144
145
|
_.each(result.channels, (channel, channelName) => {
|
|
145
146
|
if (channel.parameters) {
|
|
@@ -157,7 +158,7 @@ function from__2_0_0_rc1__to__2_0_0_rc2(asyncapi2rc1, options) { // NOSONAR
|
|
|
157
158
|
const message = channel.publish.message;
|
|
158
159
|
convertMessage(message);
|
|
159
160
|
}
|
|
160
|
-
|
|
161
|
+
|
|
161
162
|
if (channel.subscribe && channel.subscribe.message) {
|
|
162
163
|
const message = channel.subscribe.message;
|
|
163
164
|
convertMessage(message);
|
|
@@ -177,7 +178,7 @@ function from__2_0_0_rc1__to__2_0_0_rc2(asyncapi2rc1, options) { // NOSONAR
|
|
|
177
178
|
channel.subscribe.bindings = channel.subscribe.protocolInfo;
|
|
178
179
|
delete channel.subscribe.protocolInfo;
|
|
179
180
|
}
|
|
180
|
-
});
|
|
181
|
+
});
|
|
181
182
|
}
|
|
182
183
|
|
|
183
184
|
if (!options.id) delete result.id;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asyncapi/converter",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Convert AsyncAPI documents from older to newer versions.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"asyncapi-converter": "cli.js"
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
"author": "Fran Mendez <fmvilas@gmail.com> (fmvilas.com)",
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"commander": "^
|
|
37
|
-
"js-yaml": "^3.
|
|
38
|
-
"lodash": "^4.17.
|
|
39
|
-
"mocha": "^6.1.4"
|
|
36
|
+
"commander": "^8.3.0",
|
|
37
|
+
"js-yaml": "^3.14.1",
|
|
38
|
+
"lodash": "^4.17.21"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
|
-
"@semantic-release/commit-analyzer": "^
|
|
43
|
-
"@semantic-release/github": "^
|
|
44
|
-
"@semantic-release/npm": "^
|
|
45
|
-
"@semantic-release/release-notes-generator": "^
|
|
46
|
-
"conventional-changelog-conventionalcommits": "^4.
|
|
47
|
-
"semantic-release": "^
|
|
41
|
+
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
42
|
+
"@semantic-release/github": "^8.0.2",
|
|
43
|
+
"@semantic-release/npm": "^8.0.3",
|
|
44
|
+
"@semantic-release/release-notes-generator": "^10.0.3",
|
|
45
|
+
"conventional-changelog-conventionalcommits": "^4.6.3",
|
|
46
|
+
"semantic-release": "^18.0.1",
|
|
47
|
+
"mocha": "^9.1.3"
|
|
48
48
|
},
|
|
49
49
|
"release": {
|
|
50
50
|
"branches": [
|