Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit 971bc14

Browse files
authored
feat: init version of the github action (#2)
1 parent cf0e647 commit 971bc14

17 files changed

+80957
-0
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
output
2+
node_modules

.eslintrc

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
env:
2+
node: true
3+
es6: true
4+
5+
plugins:
6+
- sonarjs
7+
8+
extends:
9+
- plugin:sonarjs/recommended
10+
11+
parserOptions:
12+
ecmaVersion: 2018
13+
14+
rules:
15+
# Ignore Rules
16+
strict: 0
17+
no-underscore-dangle: 0
18+
no-mixed-requires: 0
19+
no-process-exit: 0
20+
no-warning-comments: 0
21+
curly: 0
22+
no-multi-spaces: 0
23+
no-alert: 0
24+
consistent-return: 0
25+
consistent-this: [0, self]
26+
func-style: 0
27+
max-nested-callbacks: 0
28+
29+
# Warnings
30+
no-debugger: 1
31+
no-empty: 1
32+
no-invalid-regexp: 1
33+
no-unused-expressions: 1
34+
no-native-reassign: 1
35+
no-fallthrough: 1
36+
camelcase: 0
37+
38+
# Errors
39+
eqeqeq: 2
40+
no-undef: 2
41+
no-dupe-keys: 2
42+
no-empty-character-class: 2
43+
no-self-compare: 2
44+
valid-typeof: 2
45+
no-unused-vars: [2, { "args": "none" }]
46+
handle-callback-err: 2
47+
no-shadow-restricted-names: 2
48+
no-new-require: 2
49+
no-mixed-spaces-and-tabs: 2
50+
block-scoped-var: 2
51+
no-else-return: 2
52+
no-throw-literal: 2
53+
no-void: 2
54+
radix: 2
55+
wrap-iife: [2, outside]
56+
no-shadow: 0
57+
no-use-before-define: [2, nofunc]
58+
no-path-concat: 2
59+
valid-jsdoc: [0, {requireReturn: false, requireParamDescription: false, requireReturnDescription: false}]
60+
61+
# stylistic errors
62+
no-spaced-func: 2
63+
semi-spacing: 2
64+
quotes: [2, 'single']
65+
key-spacing: [2, { beforeColon: false, afterColon: true }]
66+
indent: [2, 2]
67+
no-lonely-if: 2
68+
no-floating-decimal: 2
69+
brace-style: [2, 1tbs, { allowSingleLine: true }]
70+
comma-style: [2, last]
71+
no-multiple-empty-lines: [2, {max: 1}]
72+
no-nested-ternary: 2
73+
operator-assignment: [2, always]
74+
padded-blocks: [2, never]
75+
quote-props: [2, as-needed]
76+
keyword-spacing: [2, {'before': true, 'after': true, 'overrides': {}}]
77+
space-before-blocks: [2, always]
78+
array-bracket-spacing: [2, never]
79+
computed-property-spacing: [2, never]
80+
space-in-parens: [2, never]
81+
space-unary-ops: [2, {words: true, nonwords: false}]
82+
wrap-regex: 2
83+
linebreak-style: [2, unix]
84+
semi: [2, always]
85+
arrow-spacing: [2, {before: true, after: true}]
86+
no-class-assign: 2
87+
no-const-assign: 2
88+
no-dupe-class-members: 2
89+
no-this-before-super: 2
90+
no-var: 2
91+
object-shorthand: [2, always]
92+
prefer-arrow-callback: 2
93+
prefer-const: 2
94+
prefer-spread: 2
95+
prefer-template: 2
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Automerge release bump PR
2+
3+
on:
4+
pull_request:
5+
types:
6+
- labeled
7+
- unlabeled
8+
- synchronize
9+
- opened
10+
- edited
11+
- ready_for_review
12+
- reopened
13+
- unlocked
14+
pull_request_review:
15+
types:
16+
- submitted
17+
check_suite:
18+
types:
19+
- completed
20+
status: {}
21+
22+
jobs:
23+
24+
autoapprove:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Autoapproving
28+
uses: hmarr/[email protected]
29+
if: github.actor == 'asyncapi-bot'
30+
with:
31+
github-token: "${{ secrets.GITHUB_TOKEN }}"
32+
33+
automerge:
34+
needs: [autoapprove]
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Automerging
38+
uses: pascalgn/[email protected]
39+
if: github.actor == 'asyncapi-bot'
40+
env:
41+
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
42+
GITHUB_LOGIN: asyncapi-bot
43+
MERGE_LABELS: ""
44+
MERGE_METHOD: "squash"
45+
MERGE_COMMIT_MESSAGE: "pull-request-title"
46+
MERGE_RETRIES: "10"
47+
MERGE_RETRY_SLEEP: "10000"

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
name: 'Release GitHub'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repo
14+
uses: actions/checkout@v2
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: 13
19+
- name: Install dependencies
20+
run: npm ci
21+
- name: Run tests
22+
run: npm test
23+
- name: Get version from package.json before release step
24+
id: initversion
25+
run: echo "::set-output name=version::$(npm run get-version --silent)"
26+
- name: Release to GitHub
27+
id: release
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
30+
GIT_AUTHOR_NAME: asyncapi-bot
31+
GIT_AUTHOR_EMAIL: [email protected]
32+
GIT_COMMITTER_NAME: asyncapi-bot
33+
GIT_COMMITTER_EMAIL: [email protected]
34+
run: npm run release
35+
- name: Get version from package.json after release step
36+
id: extractver
37+
run: echo "::set-output name=version::$(npm run get-version --silent)"
38+
- name: Create Pull Request with updated package files
39+
if: steps.initversion.outputs.version != steps.extractver.outputs.version
40+
uses: peter-evans/[email protected]
41+
with:
42+
token: ${{ secrets.GH_TOKEN }}
43+
commit-message: 'chore(release): ${{ steps.extractver.outputs.version }}'
44+
committer: asyncapi-bot <[email protected]>
45+
author: asyncapi-bot <[email protected]>
46+
title: 'chore(release): ${{ steps.extractver.outputs.version }}'
47+
body: 'Version bump in package.json and package-lock.json for release [${{ steps.extractver.outputs.version }}](https://github.com/${{github.repository}}/releases/tag/v${{ steps.extractver.outputs.version }})'
48+
branch: version-bump/${{ steps.extractver.outputs.version }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Manage stale issues and PRs
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
7+
jobs:
8+
stale:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/[email protected]
12+
with:
13+
repo-token: ${{ secrets.GITHUB_TOKEN }}
14+
stale-issue-message: |
15+
This issue has been automatically marked as stale because it has not had recent activity :sleeping:
16+
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
17+
Thank you for your contributions :heart:
18+
stale-pr-message: |
19+
This pull request has been automatically marked as stale because it has not had recent activity :sleeping:
20+
It will be closed in 30 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation.
21+
Thank you for your contributions :heart:
22+
days-before-stale: 60
23+
days-before-close: 30
24+
stale-issue-label: stale
25+
stale-pr-label: stale
26+
exempt-issue-label: keep-open
27+
exempt-pr-label: keep-open
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Welcome first time contributors
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
issues:
8+
types:
9+
- opened
10+
11+
jobs:
12+
welcome:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/[email protected]
16+
with:
17+
repo-token: ${{ secrets.GITHUB_TOKEN }}
18+
issue-message: |
19+
Welcome to AsyncAPI. Thanks a lot for reporting your first issue.
20+
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).
21+
pr-message: |
22+
Welcome to AsyncAPI. Thanks a lot for creating your first pull request.
23+
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).

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
node_modules
3+
.DS_Store
4+
output

README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# GitHub Action for Generator
2+
3+
This action generates whatever you want using your AsyncAPI document. It uses [AsyncAPI Generator](https://github.com/asyncapi/generator/).
4+
5+
## Inputs
6+
7+
### `template`
8+
9+
Template for the generator. Official templates are listed here https://github.com/search?q=topic%3Aasyncapi+topic%3Agenerator+topic%3Atemplate. You can pass template as npm package, url to git repository, link to tar file or local template.
10+
11+
**Default** points to `@asyncapi/markdown-template` template.
12+
13+
### `filepath`
14+
15+
Location of the AsyncAPI document.
16+
17+
**Default** expects `asyncapi.yml` in the root of the working directory.
18+
19+
### `parameters`
20+
21+
The template that you use might support and even require specific parameters to be passed to the template for the generation.
22+
23+
### `output`
24+
25+
Directory where to put the generated files.
26+
27+
**Default** points to `output` directory in the working directory.
28+
29+
## Outputs
30+
31+
### `files`
32+
33+
List of generated files.
34+
35+
## Example usage
36+
37+
### Basic
38+
39+
In case all defaults are fine for you, just add such step:
40+
41+
```
42+
- name: Generating Markdown from my AsyncAPI document
43+
uses: asyncapi/[email protected]
44+
```
45+
46+
### Using all possible inputs
47+
48+
In case you do not want to use defaults, you for example want to use different template:
49+
50+
```
51+
- name: Generating HTML from my AsyncAPI document
52+
uses: asyncapi/[email protected]
53+
with:
54+
template: '@asyncapi/html-template' #In case of template from npm, because of @ it must be in quotes
55+
filepath: docs/api/my-asyncapi.yml
56+
parameters: baseHref=/test-experiment/ sidebarOrganization=byTags #space separated list of key/values
57+
output: generated-html
58+
```
59+
60+
### Accessing output of generation step
61+
62+
In case you want to have more steps in your workflow after generation and you need to know what files were exactly generated, you can access this information as shown below:
63+
64+
```
65+
- name: Generating Markdown from my AsyncAPI document
66+
id: generation
67+
uses: asyncapi/[email protected]
68+
- name: Another step where I want to know what files were generated so I can pass it to another step and process them forward if needed
69+
run: echo '${{steps.generation.outputs.files}}'
70+
```
71+
72+
### Example workflow with publishing generated HTML to GitHub Pages
73+
74+
In case you want to validate your asyncapi file first, and also send generated HTML to GitHub Pages this is how full workflow could look like:
75+
76+
```
77+
78+
name: AsyncAPI documents processing
79+
80+
on:
81+
push:
82+
branches: [ master ]
83+
84+
jobs:
85+
generate:
86+
runs-on: ubuntu-latest
87+
steps:
88+
#"standard step" where repo needs to be checked-out first
89+
- name: Checkout repo
90+
uses: actions/checkout@v2
91+
92+
#Using another action for AsyncAPI for validation
93+
- name: Validating AsyncAPI document
94+
uses: WaleedAshraf/[email protected]
95+
with:
96+
filepath: docs/api/my-asyncapi.yml
97+
98+
#In case you do not want to use defaults, you for example want to use different template
99+
- name: Generating HTML from my AsyncAPI document
100+
uses: asyncapi/[email protected]
101+
with:
102+
template: '@asyncapi/html-template' #In case of template from npm, because of @ it must be in quotes
103+
filepath: docs/api/my-asyncapi.yml
104+
parameters: baseHref=/test-experiment/ sidebarOrganization=byTags #space separated list of key/values
105+
output: generated-html
106+
107+
#Using another action that takes generated HTML and pushes it to GH Pages
108+
- name: Deploy GH page
109+
uses: JamesIves/[email protected]
110+
with:
111+
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
BRANCH: gh-pages
113+
FOLDER: generated-html
114+
```

action.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 'Generator for AsyncAPI documents'
2+
description: 'Use this action to generate docs or code from your AsyncAPI document. Use default templates or provide your custom ones.'
3+
inputs:
4+
template:
5+
description: 'Template for the generator. Official templates are listed here https://github.com/search?q=topic%3Aasyncapi+topic%3Agenerator+topic%3Atemplate. You can pass template as npm package, url to git repository, link to tar file or local template.'
6+
default: '@asyncapi/markdown-template'
7+
required: false
8+
filepath:
9+
description: 'Location of the AsyncAPI document.'
10+
default: 'asyncapi.yml'
11+
required: false
12+
parameters:
13+
description: 'The template that you use might support and even require specific parameters to be passed to the template for the generation.'
14+
required: false
15+
output:
16+
description: 'Directory where to put the generated files.'
17+
required: false
18+
default: 'output'
19+
outputs:
20+
files:
21+
description: 'List of generated files.'
22+
runs:
23+
using: 'node12'
24+
main: 'dist/index.js'
25+
branding:
26+
icon: 'file-text'
27+
color: purple

dist/fsevents.node

35.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)