@asyncapi/converter 0.6.0 → 0.7.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.
@@ -0,0 +1,68 @@
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 issue with 'Good First Issue' and 'area/*' with a single command.
5
+ name: Add 'Good First Issue' and 'area/*' labels # if proper comment added
6
+
7
+ on:
8
+ issue_comment:
9
+ types:
10
+ - created
11
+
12
+ jobs:
13
+ add-labels:
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: Add label
18
+ if: contains(github.event.comment.body, '/good-first-issue') || contains(github.event.comment.body, '/gfi' )
19
+ uses: actions/github-script@v5
20
+ with:
21
+ github-token: ${{ secrets.GH_TOKEN }}
22
+ script: |
23
+ const areas = ['javascript', 'typescript', 'java' , 'go', 'docs', 'ci-cd', 'design'];
24
+ const values = context.payload.comment.body.split(" ");
25
+ switch(values[1]){
26
+ case 'ts':
27
+ values[1] = 'typescript';
28
+ break;
29
+ case 'js':
30
+ values[1] = 'javascript';
31
+ case 'markdown':
32
+ values[1] = 'docs';
33
+ }
34
+ if(values.length != 2 || !areas.includes(values[1])){
35
+ const message = `Hey @${context.payload.sender.login}, your message doesn't follow the requirements, you can try \`/help\`.`
36
+
37
+ await github.rest.issues.createComment({
38
+ issue_number: context.issue.number,
39
+ owner: context.repo.owner,
40
+ repo: context.repo.repo,
41
+ body: message
42
+ })
43
+ } else {
44
+
45
+ //remove complexity and areas if there are any before adding new labels;
46
+ const currentLabels = (await github.rest.issues.listLabelsOnIssue({
47
+ issue_number: context.issue.number,
48
+ owner: context.repo.owner,
49
+ repo: context.repo.repo,
50
+ })).data.map(label => label.name);
51
+
52
+ const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(values[1])));
53
+ shouldBeRemoved.forEach(label => {
54
+ github.rest.issues.deleteLabel({
55
+ owner: context.repo.owner,
56
+ repo: context.repo.repo,
57
+ name: label,
58
+ });
59
+ });
60
+
61
+ //add new labels
62
+ github.rest.issues.addLabels({
63
+ issue_number: context.issue.number,
64
+ owner: context.repo.owner,
65
+ repo: context.repo.repo,
66
+ labels: ['good first issue', `area/${values[1]}`]
67
+ });
68
+ }
@@ -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: "{pullRequest.title} (#{pullRequest.number})"
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,47 +1,50 @@
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
 
6
6
  on:
7
7
  pull_request_target:
8
8
  types:
9
- - labeled
10
- - unlabeled
11
- - synchronize
12
9
  - opened
13
- - edited
14
- - ready_for_review
15
- - reopened
16
- - unlocked
17
- pull_request_review:
18
- types:
19
- - submitted
20
-
21
- jobs:
10
+ - synchronize
22
11
 
12
+ jobs:
23
13
  autoapprove:
24
- if: github.event.pull_request.draft == false
14
+ if: >
15
+ contains(fromJson('["asyncapi-bot", "dependabot[bot]", "dependabot-preview[bot]"]'), github.event.pull_request.user.login) &&
16
+ contains(fromJson('["asyncapi-bot", "dependabot[bot]", "dependabot-preview[bot]"]'), github.actor) &&
17
+ !contains(github.event.pull_request.labels.*.name, 'released')
25
18
  runs-on: ubuntu-latest
26
19
  steps:
27
20
  - name: Autoapproving
28
21
  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
22
  with:
31
23
  github-token: "${{ secrets.GITHUB_TOKEN }}"
32
24
 
25
+ - name: Label autoapproved
26
+ uses: actions/github-script@v5
27
+ with:
28
+ github-token: ${{ secrets.GH_TOKEN }}
29
+ script: |
30
+ github.rest.issues.addLabels({
31
+ issue_number: context.issue.number,
32
+ owner: context.repo.owner,
33
+ repo: context.repo.repo,
34
+ labels: ['autoapproved']
35
+ })
36
+
33
37
  automerge:
34
38
  needs: [autoapprove]
35
39
  runs-on: ubuntu-latest
36
40
  steps:
37
41
  - name: Automerging
38
42
  uses: pascalgn/automerge-action@v0.13.0
39
- if: github.actor == 'asyncapi-bot' || github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
40
43
  env:
41
44
  GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
42
45
  GITHUB_LOGIN: asyncapi-bot
43
46
  MERGE_LABELS: ""
44
47
  MERGE_METHOD: "squash"
45
- MERGE_COMMIT_MESSAGE: "pull-request-title"
48
+ MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})"
46
49
  MERGE_RETRIES: "20"
47
- MERGE_RETRY_SLEEP: "30000"
50
+ MERGE_RETRY_SLEEP: "30000"
@@ -0,0 +1,32 @@
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
+ branches-ignore:
16
+ - 'version-bump/**'
17
+ - 'dependabot/**'
18
+ - 'bot/**'
19
+ - 'all-contributors/**'
20
+
21
+ jobs:
22
+ autoupdate:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - name: Autoupdating
26
+ uses: docker://chinthakagodawita/autoupdate-action:v1
27
+ env:
28
+ GITHUB_TOKEN: '${{ secrets.GH_TOKEN }}'
29
+ PR_FILTER: "labelled"
30
+ PR_LABELS: "autoapproved"
31
+ PR_READY_STATE: "ready_for_review"
32
+ MERGE_CONFLICT_ACTION: "ignore"
@@ -15,6 +15,7 @@ on:
15
15
 
16
16
  jobs:
17
17
  bump:
18
+ if: startsWith(github.event.commits[0].message, 'chore(release):')
18
19
  runs-on: ubuntu-latest
19
20
  steps:
20
21
  - name: Checkout repo
@@ -22,9 +23,9 @@ jobs:
22
23
  - name: Check if Node.js project and has package.json
23
24
  id: packagejson
24
25
  run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
25
- - if: steps.packagejson.outputs.exists == 'true' && startsWith(github.event.commits[0].message, 'chore(release):')
26
+ - if: steps.packagejson.outputs.exists == 'true'
26
27
  name: Bumping latest version of this package in other repositories
27
- uses: derberg/npm-dependency-manager-for-your-github-org@v3
28
+ uses: derberg/npm-dependency-manager-for-your-github-org@v4
28
29
  with:
29
30
  github_token: ${{ secrets.GH_TOKEN }}
30
31
  committer_username: asyncapi-bot
@@ -0,0 +1,43 @@
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_pr:
13
+ if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions-ecosystem/action-create-comment@v1
17
+ with:
18
+ github_token: ${{ secrets.GH_TOKEN }}
19
+ body: |
20
+ Hello, @${{ github.actor }}! 👋🏼
21
+
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
+ create_help_comment_issue:
29
+ if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }}
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - uses: actions-ecosystem/action-create-comment@v1
33
+ with:
34
+ github_token: ${{ secrets.GH_TOKEN }}
35
+ body: |
36
+ Hello, @${{ github.actor }}! 👋🏼
37
+
38
+ I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘
39
+
40
+ At the moment the following comments are supported in issues:
41
+
42
+ - `/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`.
43
+ example: `/gfi js` or `/good-first-issue ci-cd`
@@ -6,16 +6,21 @@ name: PR testing - if Go project
6
6
  on:
7
7
  pull_request:
8
8
  types: [opened, reopened, synchronize, ready_for_review]
9
-
9
+
10
10
  jobs:
11
11
  lint:
12
- if: github.event.pull_request.draft == false
13
12
  name: lint
14
13
  runs-on: ubuntu-latest
15
14
  steps:
16
- - name: Checkout repository
15
+ - if: "github.event.pull_request.draft == false &&!((github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'ci: update global workflows')) || (github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'chore(release):')) || (github.actor == 'allcontributors' && startsWith(github.event.pull_request.title, 'docs: add')))"
16
+ id: should_run
17
+ name: Should Run
18
+ run: echo "::set-output name=shouldrun::true"
19
+ - if: steps.should_run.outputs.shouldrun == 'true'
20
+ name: Checkout repository
17
21
  uses: actions/checkout@v2
18
- - name: Check if Go project and has go.mod
22
+ - if: steps.should_run.outputs.shouldrun == 'true'
23
+ name: Check if Go project and has go.mod
19
24
  id: gomod
20
25
  run: test -e ./go.mod && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
21
26
  shell: bash
@@ -31,16 +36,21 @@ jobs:
31
36
  skip-go-installation: true # we wanna control the version of Go in use
32
37
 
33
38
  test:
34
- if: github.event.pull_request.draft == false
35
39
  name: ${{ matrix.os }}
36
40
  runs-on: ${{ matrix.os }}
37
41
  strategy:
38
42
  matrix:
39
43
  os: [ubuntu-latest, macos-latest, windows-latest]
40
44
  steps:
41
- - name: Checkout repository
45
+ - if: "github.event.pull_request.draft == false &&!((github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'ci: update global workflows')) || (github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'chore(release):')) || (github.actor == 'allcontributors' && startsWith(github.event.pull_request.title, 'docs: add')))"
46
+ id: should_run
47
+ name: Should Run
48
+ run: echo "::set-output name=shouldrun::true"
49
+ - if: steps.should_run.outputs.shouldrun == 'true'
50
+ name: Checkout repository
42
51
  uses: actions/checkout@v2
43
- - name: Check if Go project and has go.mod
52
+ - if: steps.should_run.outputs.shouldrun == 'true'
53
+ name: Check if Go project and has go.mod
44
54
  id: gomod
45
55
  run: test -e ./go.mod && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
46
56
  shell: bash
@@ -9,24 +9,36 @@ on:
9
9
 
10
10
  jobs:
11
11
  test:
12
- if: github.event.pull_request.draft == false
13
12
  name: ${{ matrix.os }}
14
13
  runs-on: ${{ matrix.os }}
15
14
  strategy:
16
15
  matrix:
17
16
  os: [ubuntu-latest, macos-latest, windows-latest]
18
17
  steps:
19
- - name: Checkout repository
18
+ - if: "github.event.pull_request.draft == false &&!((github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'ci: update global workflows')) || (github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'chore(release):')) || (github.actor == 'allcontributors' && startsWith(github.event.pull_request.title, 'docs: add')))"
19
+ id: should_run
20
+ name: Should Run
21
+ run: echo "::set-output name=shouldrun::true"
22
+ - if: steps.should_run.outputs.shouldrun == 'true'
23
+ name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
24
+ run: |
25
+ git config --global core.autocrlf false
26
+ git config --global core.eol lf
27
+ - if: steps.should_run.outputs.shouldrun == 'true'
28
+ name: Checkout repository
20
29
  uses: actions/checkout@v2
21
- - name: Check if Node.js project and has package.json
30
+ - if: steps.should_run.outputs.shouldrun == 'true'
31
+ name: Check if Node.js project and has package.json
22
32
  id: packagejson
23
33
  run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
24
34
  shell: bash
25
35
  - if: steps.packagejson.outputs.exists == 'true'
26
36
  name: Setup Node.js
27
- uses: actions/setup-node@v1
37
+ uses: actions/setup-node@v2
28
38
  with:
29
39
  node-version: 14
40
+ cache: 'npm'
41
+ cache-dependency-path: '**/package-lock.json'
30
42
  - if: steps.packagejson.outputs.exists == 'true'
31
43
  name: Install dependencies
32
44
  id: first-installation
@@ -10,7 +10,10 @@ on:
10
10
  # below lines are not enough to have release supported for these branches
11
11
  # make sure configuration of `semantic-release` package mentiones these branches
12
12
  - next
13
- - '**-release'
13
+ - next-major
14
+ - beta
15
+ - alpha
16
+ - '**-release' # custom
14
17
 
15
18
  jobs:
16
19
 
@@ -21,6 +24,10 @@ jobs:
21
24
  matrix:
22
25
  os: [ubuntu-latest, macos-latest, windows-latest]
23
26
  steps:
27
+ - name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
28
+ run: |
29
+ git config --global core.autocrlf false
30
+ git config --global core.eol lf
24
31
  - name: Checkout repository
25
32
  uses: actions/checkout@v2
26
33
  - name: Check if Node.js project and has package.json
@@ -29,9 +36,11 @@ jobs:
29
36
  shell: bash
30
37
  - if: steps.packagejson.outputs.exists == 'true'
31
38
  name: Setup Node.js
32
- uses: actions/setup-node@v1
39
+ uses: actions/setup-node@v2
33
40
  with:
34
41
  node-version: 14
42
+ cache: 'npm'
43
+ cache-dependency-path: '**/package-lock.json'
35
44
  - if: steps.packagejson.outputs.exists == 'true'
36
45
  name: Install dependencies
37
46
  run: npm install
@@ -41,9 +50,13 @@ jobs:
41
50
 
42
51
  release:
43
52
  needs: test
44
- name: Publish to NPM and GitHub
53
+ name: Publish to any of NPM, Github, and Docker Hub
45
54
  runs-on: ubuntu-latest
46
55
  steps:
56
+ - name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
57
+ run: |
58
+ git config --global core.autocrlf false
59
+ git config --global core.eol lf
47
60
  - name: Checkout repository
48
61
  uses: actions/checkout@v2
49
62
  - name: Check if Node.js project and has package.json
@@ -58,13 +71,15 @@ jobs:
58
71
  name: Install dependencies
59
72
  run: npm install
60
73
  - if: steps.packagejson.outputs.exists == 'true'
61
- name: Release to NPM and GitHub
74
+ name: Publish to any of NPM, Github, and Docker Hub
62
75
  id: release
63
76
  env:
64
77
  GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
65
78
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
79
+ DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
80
+ DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
66
81
  GIT_AUTHOR_NAME: asyncapi-bot
67
82
  GIT_AUTHOR_EMAIL: info@asyncapi.io
68
83
  GIT_COMMITTER_NAME: asyncapi-bot
69
84
  GIT_COMMITTER_EMAIL: info@asyncapi.io
70
- run: npm run release
85
+ run: npm run release
@@ -13,7 +13,7 @@ on:
13
13
  types: [opened, reopened, ready_for_review]
14
14
 
15
15
  discussion:
16
- types: [opened]
16
+ types: [created]
17
17
 
18
18
  jobs:
19
19