@asyncapi/converter 0.9.0 → 1.0.0

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.
Files changed (58) hide show
  1. package/README.md +96 -21
  2. package/lib/convert.d.ts +3 -0
  3. package/lib/convert.js +192 -0
  4. package/lib/index.d.ts +2 -0
  5. package/lib/index.js +5 -212
  6. package/lib/interfaces.d.ts +6 -0
  7. package/lib/interfaces.js +2 -0
  8. package/lib/utils.d.ts +21 -0
  9. package/lib/utils.js +114 -0
  10. package/package.json +24 -12
  11. package/.github/workflows/add-good-first-issue-labels.yml +0 -68
  12. package/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml +0 -54
  13. package/.github/workflows/automerge-for-humans-merging.yml +0 -32
  14. package/.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml +0 -35
  15. package/.github/workflows/automerge-orphans.yml +0 -63
  16. package/.github/workflows/automerge.yml +0 -50
  17. package/.github/workflows/autoupdate.yml +0 -32
  18. package/.github/workflows/bump.yml +0 -33
  19. package/.github/workflows/help-command.yml +0 -43
  20. package/.github/workflows/if-go-pr-testing.yml +0 -68
  21. package/.github/workflows/if-nodejs-pr-testing.yml +0 -60
  22. package/.github/workflows/if-nodejs-release.yml +0 -85
  23. package/.github/workflows/if-nodejs-version-bump.yml +0 -48
  24. package/.github/workflows/issues-prs-notifications.yml +0 -72
  25. package/.github/workflows/lint-pr-title.yml +0 -22
  26. package/.github/workflows/notify-tsc-members-mention.yml +0 -142
  27. package/.github/workflows/release-announcements.yml +0 -76
  28. package/.github/workflows/sentiment-analysis.yml +0 -44
  29. package/.github/workflows/stale-issues-prs.yml +0 -42
  30. package/.github/workflows/welcome-first-time-contrib.yml +0 -83
  31. package/CODEOWNERS +0 -8
  32. package/cli.js +0 -66
  33. package/lib/helpers.js +0 -109
  34. package/test/index.js +0 -257
  35. package/test/input/1.0.0/streetlights.yml +0 -120
  36. package/test/input/1.1.0/streetlights.yml +0 -120
  37. package/test/input/1.2.0/gitter-streaming.yml +0 -140
  38. package/test/input/1.2.0/slack-rtm.yml +0 -876
  39. package/test/input/1.2.0/streetlights.yml +0 -120
  40. package/test/input/2.0.0/streetlights.json +0 -172
  41. package/test/input/2.0.0/streetlights.yml +0 -112
  42. package/test/input/2.0.0-rc1/streetlights.yml +0 -109
  43. package/test/input/2.0.0-rc2/streetlights.yml +0 -112
  44. package/test/input/2.1.0/streetlights.yml +0 -112
  45. package/test/input/2.2.0/streetlights.yml +0 -112
  46. package/test/output/2.0.0/gitter-streaming.yml +0 -137
  47. package/test/output/2.0.0/slack-rtm.yml +0 -879
  48. package/test/output/2.0.0/streetlights.yml +0 -112
  49. package/test/output/2.0.0-rc1/gitter-streaming.yml +0 -137
  50. package/test/output/2.0.0-rc1/slack-rtm.yml +0 -879
  51. package/test/output/2.0.0-rc1/streetlights.yml +0 -109
  52. package/test/output/2.0.0-rc2/gitter-streaming.yml +0 -137
  53. package/test/output/2.0.0-rc2/slack-rtm.yml +0 -879
  54. package/test/output/2.0.0-rc2/streetlights.yml +0 -112
  55. package/test/output/2.1.0/streetlights.json +0 -172
  56. package/test/output/2.1.0/streetlights.yml +0 -112
  57. package/test/output/2.2.0/streetlights.yml +0 -112
  58. package/test/output/2.3.0/streetlights.yml +0 -112
package/lib/utils.js ADDED
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertMessage = exports.dotsToSlashes = exports.objectToSchema = exports.streamToChannel = exports.eventToChannel = exports.serializeInput = void 0;
4
+ const js_yaml_1 = require("js-yaml");
5
+ function serializeInput(document) {
6
+ let triedConvertToYaml = false;
7
+ try {
8
+ if (typeof document === 'object') {
9
+ return {
10
+ format: 'json',
11
+ document: JSON.parse(JSON.stringify(document)), // copy object
12
+ };
13
+ }
14
+ const maybeJSON = JSON.parse(document);
15
+ if (typeof maybeJSON === 'object') {
16
+ return {
17
+ format: 'json',
18
+ document: maybeJSON,
19
+ };
20
+ }
21
+ triedConvertToYaml = true; // NOSONAR
22
+ // if `maybeJSON` is object, then we have 100% sure that we operate on JSON,
23
+ // but if it's `string` then we have option that it can be YAML but it doesn't have to be
24
+ return {
25
+ format: 'yaml',
26
+ document: (0, js_yaml_1.load)(document),
27
+ };
28
+ }
29
+ catch (e) {
30
+ try {
31
+ if (triedConvertToYaml) {
32
+ throw e;
33
+ }
34
+ // try to parse (again) YAML, because the text itself may not have a JSON representation and cannot be represented as a JSON object/string
35
+ return {
36
+ format: 'yaml',
37
+ document: (0, js_yaml_1.load)(document),
38
+ };
39
+ }
40
+ catch (err) {
41
+ throw new Error('AsyncAPI document must be a valid JSON or YAML document.');
42
+ }
43
+ }
44
+ }
45
+ exports.serializeInput = serializeInput;
46
+ function eventToChannel(event) {
47
+ const out = {};
48
+ if (event.receive) {
49
+ out.publish = {
50
+ message: {
51
+ oneOf: event.receive
52
+ }
53
+ };
54
+ }
55
+ if (event.send) {
56
+ out.subscribe = {
57
+ message: {
58
+ oneOf: event.send
59
+ }
60
+ };
61
+ }
62
+ return out;
63
+ }
64
+ exports.eventToChannel = eventToChannel;
65
+ function streamToChannel(stream) {
66
+ const out = {};
67
+ if (stream.read) {
68
+ out.publish = {
69
+ message: {
70
+ oneOf: stream.read
71
+ }
72
+ };
73
+ }
74
+ if (stream.write) {
75
+ out.subscribe = {
76
+ message: {
77
+ oneOf: stream.write
78
+ }
79
+ };
80
+ }
81
+ return out;
82
+ }
83
+ exports.streamToChannel = streamToChannel;
84
+ function objectToSchema(obj) {
85
+ return { type: 'object', properties: Object.assign({}, obj) };
86
+ }
87
+ exports.objectToSchema = objectToSchema;
88
+ function dotsToSlashes(topic) {
89
+ return topic.replace(/\./g, '/');
90
+ }
91
+ exports.dotsToSlashes = dotsToSlashes;
92
+ function convertMessage(message) {
93
+ if (message.oneOf) {
94
+ message.oneOf.forEach((m) => {
95
+ if (m.protocolInfo) {
96
+ m.bindings = m.protocolInfo;
97
+ delete m.protocolInfo;
98
+ }
99
+ if (m.headers) {
100
+ m.headers = objectToSchema(m.headers);
101
+ }
102
+ });
103
+ }
104
+ else {
105
+ if (message.protocolInfo) {
106
+ message.bindings = message.protocolInfo;
107
+ delete message.protocolInfo;
108
+ }
109
+ if (message.headers) {
110
+ message.headers = objectToSchema(message.headers);
111
+ }
112
+ }
113
+ }
114
+ exports.convertMessage = convertMessage;
package/package.json CHANGED
@@ -1,17 +1,18 @@
1
1
  {
2
2
  "name": "@asyncapi/converter",
3
- "version": "0.9.0",
3
+ "version": "1.0.0",
4
4
  "description": "Convert AsyncAPI documents from older to newer versions.",
5
- "bin": {
6
- "asyncapi-converter": "cli.js"
7
- },
8
5
  "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
9
7
  "scripts": {
10
- "test": "mocha",
8
+ "build": "tsc",
9
+ "test": "cross-env CI=true NODE_ENV=test jest --coverage",
11
10
  "lint": "echo 'no linter configured yet'",
12
11
  "release": "semantic-release",
13
- "generate:assets": "echo 'No additional assets need to be generated at the moment'",
14
- "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION"
12
+ "generate:assets": "npm run generate:readme:toc",
13
+ "generate:readme:toc": "markdown-toc -i README.md",
14
+ "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION",
15
+ "prepublishOnly": "npm run build"
15
16
  },
16
17
  "keywords": [
17
18
  "asyncapi",
@@ -19,6 +20,11 @@
19
20
  "version",
20
21
  "convert"
21
22
  ],
23
+ "files": [
24
+ "/lib",
25
+ "./README.md",
26
+ "./LICENSE"
27
+ ],
22
28
  "repository": {
23
29
  "type": "git",
24
30
  "url": "git+https://github.com/asyncapi/converter-js.git"
@@ -33,18 +39,24 @@
33
39
  "author": "Fran Mendez <fmvilas@gmail.com> (fmvilas.com)",
34
40
  "license": "Apache-2.0",
35
41
  "dependencies": {
36
- "commander": "^8.3.0",
37
- "js-yaml": "^3.14.1",
38
- "lodash": "^4.17.21"
42
+ "js-yaml": "^3.14.1"
39
43
  },
40
44
  "devDependencies": {
45
+ "@jest/types": "^27.5.1",
41
46
  "@semantic-release/commit-analyzer": "^9.0.2",
42
47
  "@semantic-release/github": "^8.0.2",
43
48
  "@semantic-release/npm": "^8.0.3",
44
49
  "@semantic-release/release-notes-generator": "^10.0.3",
50
+ "@types/jest": "^27.4.1",
51
+ "@types/js-yaml": "^4.0.5",
45
52
  "conventional-changelog-conventionalcommits": "^4.6.3",
46
- "semantic-release": "^18.0.1",
47
- "mocha": "^9.1.3"
53
+ "cross-env": "^7.0.3",
54
+ "jest": "^27.5.1",
55
+ "semantic-release": "^19.0.3",
56
+ "ts-jest": "^27.1.3",
57
+ "ts-node": "^10.7.0",
58
+ "typescript": "^4.6.2",
59
+ "markdown-toc": "^1.2.0"
48
60
  },
49
61
  "release": {
50
62
  "branches": [
@@ -1,68 +0,0 @@
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
- }
@@ -1,54 +0,0 @@
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
- })
@@ -1,32 +0,0 @@
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"
@@ -1,35 +0,0 @@
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,63 +0,0 @@
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
- name: 'Notify on failing automerge'
5
-
6
- on:
7
- schedule:
8
- - cron: "0 0 * * *"
9
-
10
- jobs:
11
- identify-orphans:
12
- name: Find orphans and notify
13
- runs-on: ubuntu-latest
14
- steps:
15
- - name: Get list of orphans
16
- uses: actions/github-script@v3
17
- id: orphans
18
- with:
19
- github-token: ${{ secrets.GITHUB_TOKEN }}
20
- script: |
21
- const query = `query($owner:String!, $name:String!) {
22
- repository(owner:$owner, name:$name){
23
- pullRequests(first: 100, states: OPEN){
24
- nodes{
25
- title
26
- url
27
- author {
28
- resourcePath
29
- }
30
- }
31
- }
32
- }
33
- }`;
34
- const variables = {
35
- owner: context.repo.owner,
36
- name: context.repo.repo
37
- };
38
- const { repository: { pullRequests: { nodes } } } = await github.graphql(query, variables);
39
-
40
- let orphans = nodes.filter( (pr) => pr.author.resourcePath === '/asyncapi-bot' || pr.author.resourcePath === '/apps/dependabot')
41
-
42
- if (orphans.length) {
43
- core.setOutput('found', 'true');
44
- //Yes, this is very naive approach to assume there is just one PR causing issues, there can be a case that more PRs are affected the same day
45
- //The thing is that handling multiple PRs will increase a complexity in this PR that in my opinion we should avoid
46
- //The other PRs will be reported the next day the action runs, or person that checks first url will notice the other ones
47
- core.setOutput('url', orphans[0].url);
48
- core.setOutput('title', orphans[0].title);
49
- }
50
- - if: steps.orphans.outputs.found == 'true'
51
- name: Convert markdown to slack markdown
52
- uses: LoveToKnow/slackify-markdown-action@v1.0.0
53
- id: issuemarkdown
54
- with:
55
- text: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})"
56
- - if: steps.orphans.outputs.found == 'true'
57
- name: Send info about orphan to slack
58
- uses: rtCamp/action-slack-notify@v2
59
- env:
60
- SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}}
61
- SLACK_TITLE: 🚨 Not merged PR that should be automerged 🚨
62
- SLACK_MESSAGE: ${{steps.issuemarkdown.outputs.text}}
63
- MSG_MINIMAL: true
@@ -1,50 +0,0 @@
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
- name: Automerge release bump PR
5
-
6
- on:
7
- pull_request_target:
8
- types:
9
- - opened
10
- - synchronize
11
-
12
- jobs:
13
- autoapprove:
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')
18
- runs-on: ubuntu-latest
19
- steps:
20
- - name: Autoapproving
21
- uses: hmarr/auto-approve-action@v2
22
- with:
23
- github-token: "${{ secrets.GITHUB_TOKEN }}"
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
-
37
- automerge:
38
- needs: [autoapprove]
39
- runs-on: ubuntu-latest
40
- steps:
41
- - name: Automerging
42
- uses: pascalgn/automerge-action@v0.13.0
43
- env:
44
- GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
45
- GITHUB_LOGIN: asyncapi-bot
46
- MERGE_LABELS: ""
47
- MERGE_METHOD: "squash"
48
- MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})"
49
- MERGE_RETRIES: "20"
50
- MERGE_RETRY_SLEEP: "30000"
@@ -1,32 +0,0 @@
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"
@@ -1,33 +0,0 @@
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
- #Purpose of this action is to update npm package in libraries that use it. It is like dependabot for asyncapi npm modules only.
5
- #It runs in a repo after merge of release commit and searches for other packages that use released package. Every found package gets updated with lates version
6
-
7
- name: Bump package version in dependent repos - if Node project
8
-
9
- on:
10
- #It cannot run on release event as when release is created then version is not yet bumped in package.json
11
- #This means we cannot extract easily latest version and have a risk that package is not yet on npm
12
- push:
13
- branches:
14
- - master
15
-
16
- jobs:
17
- bump:
18
- if: startsWith(github.event.commits[0].message, 'chore(release):')
19
- runs-on: ubuntu-latest
20
- steps:
21
- - name: Checkout repo
22
- uses: actions/checkout@v2
23
- - name: Check if Node.js project and has package.json
24
- id: packagejson
25
- run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
26
- - if: steps.packagejson.outputs.exists == 'true'
27
- name: Bumping latest version of this package in other repositories
28
- uses: derberg/npm-dependency-manager-for-your-github-org@v4
29
- with:
30
- github_token: ${{ secrets.GH_TOKEN }}
31
- committer_username: asyncapi-bot
32
- committer_email: info@asyncapi.io
33
- repos_to_ignore: html-template #this is temporary until react component releases 1.0, then it can be removed
@@ -1,43 +0,0 @@
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`
@@ -1,68 +0,0 @@
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
- #It does magic only if there is go.mod file in the root of the project
4
- name: PR testing - if Go project
5
-
6
- on:
7
- pull_request:
8
- types: [opened, reopened, synchronize, ready_for_review]
9
-
10
- jobs:
11
- lint:
12
- name: lint
13
- runs-on: ubuntu-latest
14
- steps:
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
21
- uses: actions/checkout@v2
22
- - if: steps.should_run.outputs.shouldrun == 'true'
23
- name: Check if Go project and has go.mod
24
- id: gomod
25
- run: test -e ./go.mod && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
26
- shell: bash
27
- - if: steps.gomod.outputs.exists == 'true'
28
- name: Setup Go
29
- uses: actions/setup-go@v2.1.3
30
- with:
31
- go-version: 1.16
32
- - if: steps.gomod.outputs.exists == 'true'
33
- name: golangci-lint
34
- uses: golangci/golangci-lint-action@v2 # golangci-lint version extracted from go.mod. `latest` if missing.
35
- with:
36
- skip-go-installation: true # we wanna control the version of Go in use
37
-
38
- test:
39
- name: ${{ matrix.os }}
40
- runs-on: ${{ matrix.os }}
41
- strategy:
42
- matrix:
43
- os: [ubuntu-latest, macos-latest, windows-latest]
44
- steps:
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
51
- uses: actions/checkout@v2
52
- - if: steps.should_run.outputs.shouldrun == 'true'
53
- name: Check if Go project and has go.mod
54
- id: gomod
55
- run: test -e ./go.mod && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
56
- shell: bash
57
- - if: steps.gomod.outputs.exists == 'true'
58
- name: Setup Go
59
- uses: actions/setup-go@v2.1.3
60
- with:
61
- go-version: 1.16
62
- - if: steps.gomod.outputs.exists == 'true'
63
- name: Build
64
- run: go build -v ./...
65
- - if: steps.gomod.outputs.exists == 'true'
66
- name: Test
67
- run: go test -v ./...
68
-