-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init version of the github action (#2)
- Loading branch information
Showing
17 changed files
with
80,957 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
output | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
env: | ||
node: true | ||
es6: true | ||
|
||
plugins: | ||
- sonarjs | ||
|
||
extends: | ||
- plugin:sonarjs/recommended | ||
|
||
parserOptions: | ||
ecmaVersion: 2018 | ||
|
||
rules: | ||
# Ignore Rules | ||
strict: 0 | ||
no-underscore-dangle: 0 | ||
no-mixed-requires: 0 | ||
no-process-exit: 0 | ||
no-warning-comments: 0 | ||
curly: 0 | ||
no-multi-spaces: 0 | ||
no-alert: 0 | ||
consistent-return: 0 | ||
consistent-this: [0, self] | ||
func-style: 0 | ||
max-nested-callbacks: 0 | ||
|
||
# Warnings | ||
no-debugger: 1 | ||
no-empty: 1 | ||
no-invalid-regexp: 1 | ||
no-unused-expressions: 1 | ||
no-native-reassign: 1 | ||
no-fallthrough: 1 | ||
camelcase: 0 | ||
|
||
# Errors | ||
eqeqeq: 2 | ||
no-undef: 2 | ||
no-dupe-keys: 2 | ||
no-empty-character-class: 2 | ||
no-self-compare: 2 | ||
valid-typeof: 2 | ||
no-unused-vars: [2, { "args": "none" }] | ||
handle-callback-err: 2 | ||
no-shadow-restricted-names: 2 | ||
no-new-require: 2 | ||
no-mixed-spaces-and-tabs: 2 | ||
block-scoped-var: 2 | ||
no-else-return: 2 | ||
no-throw-literal: 2 | ||
no-void: 2 | ||
radix: 2 | ||
wrap-iife: [2, outside] | ||
no-shadow: 0 | ||
no-use-before-define: [2, nofunc] | ||
no-path-concat: 2 | ||
valid-jsdoc: [0, {requireReturn: false, requireParamDescription: false, requireReturnDescription: false}] | ||
|
||
# stylistic errors | ||
no-spaced-func: 2 | ||
semi-spacing: 2 | ||
quotes: [2, 'single'] | ||
key-spacing: [2, { beforeColon: false, afterColon: true }] | ||
indent: [2, 2] | ||
no-lonely-if: 2 | ||
no-floating-decimal: 2 | ||
brace-style: [2, 1tbs, { allowSingleLine: true }] | ||
comma-style: [2, last] | ||
no-multiple-empty-lines: [2, {max: 1}] | ||
no-nested-ternary: 2 | ||
operator-assignment: [2, always] | ||
padded-blocks: [2, never] | ||
quote-props: [2, as-needed] | ||
keyword-spacing: [2, {'before': true, 'after': true, 'overrides': {}}] | ||
space-before-blocks: [2, always] | ||
array-bracket-spacing: [2, never] | ||
computed-property-spacing: [2, never] | ||
space-in-parens: [2, never] | ||
space-unary-ops: [2, {words: true, nonwords: false}] | ||
wrap-regex: 2 | ||
linebreak-style: [2, unix] | ||
semi: [2, always] | ||
arrow-spacing: [2, {before: true, after: true}] | ||
no-class-assign: 2 | ||
no-const-assign: 2 | ||
no-dupe-class-members: 2 | ||
no-this-before-super: 2 | ||
no-var: 2 | ||
object-shorthand: [2, always] | ||
prefer-arrow-callback: 2 | ||
prefer-const: 2 | ||
prefer-spread: 2 | ||
prefer-template: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Automerge release bump PR | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- labeled | ||
- unlabeled | ||
- synchronize | ||
- opened | ||
- edited | ||
- ready_for_review | ||
- reopened | ||
- unlocked | ||
pull_request_review: | ||
types: | ||
- submitted | ||
check_suite: | ||
types: | ||
- completed | ||
status: {} | ||
|
||
jobs: | ||
|
||
autoapprove: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Autoapproving | ||
uses: hmarr/[email protected] | ||
if: github.actor == 'asyncapi-bot' | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
automerge: | ||
needs: [autoapprove] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Automerging | ||
uses: pascalgn/[email protected] | ||
if: github.actor == 'asyncapi-bot' | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}" | ||
GITHUB_LOGIN: asyncapi-bot | ||
MERGE_LABELS: "" | ||
MERGE_METHOD: "squash" | ||
MERGE_COMMIT_MESSAGE: "pull-request-title" | ||
MERGE_RETRIES: "10" | ||
MERGE_RETRY_SLEEP: "10000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
release: | ||
name: 'Release GitHub' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 13 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Run tests | ||
run: npm test | ||
- name: Get version from package.json before release step | ||
id: initversion | ||
run: echo "::set-output name=version::$(npm run get-version --silent)" | ||
- name: Release to GitHub | ||
id: release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
GIT_AUTHOR_NAME: asyncapi-bot | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GIT_COMMITTER_NAME: asyncapi-bot | ||
GIT_COMMITTER_EMAIL: [email protected] | ||
run: npm run release | ||
- name: Get version from package.json after release step | ||
id: extractver | ||
run: echo "::set-output name=version::$(npm run get-version --silent)" | ||
- name: Create Pull Request with updated package files | ||
if: steps.initversion.outputs.version != steps.extractver.outputs.version | ||
uses: peter-evans/[email protected] | ||
with: | ||
token: ${{ secrets.GH_TOKEN }} | ||
commit-message: 'chore(release): ${{ steps.extractver.outputs.version }}' | ||
committer: asyncapi-bot <[email protected]> | ||
author: asyncapi-bot <[email protected]> | ||
title: 'chore(release): ${{ steps.extractver.outputs.version }}' | ||
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 }})' | ||
branch: version-bump/${{ steps.extractver.outputs.version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Manage stale issues and PRs | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
stale: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
stale-issue-message: | | ||
This issue has been automatically marked as stale because it has not had recent activity :sleeping: | ||
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation. | ||
Thank you for your contributions :heart: | ||
stale-pr-message: | | ||
This pull request has been automatically marked as stale because it has not had recent activity :sleeping: | ||
It will be closed in 30 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation. | ||
Thank you for your contributions :heart: | ||
days-before-stale: 60 | ||
days-before-close: 30 | ||
stale-issue-label: stale | ||
stale-pr-label: stale | ||
exempt-issue-label: keep-open | ||
exempt-pr-label: keep-open |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Welcome first time contributors | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
issues: | ||
types: | ||
- opened | ||
|
||
jobs: | ||
welcome: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-message: | | ||
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. | ||
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). | ||
pr-message: | | ||
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. | ||
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
node_modules | ||
.DS_Store | ||
output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# GitHub Action for Generator | ||
|
||
This action generates whatever you want using your AsyncAPI document. It uses [AsyncAPI Generator](https://github.com/asyncapi/generator/). | ||
|
||
## Inputs | ||
|
||
### `template` | ||
|
||
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. | ||
|
||
**Default** points to `@asyncapi/markdown-template` template. | ||
|
||
### `filepath` | ||
|
||
Location of the AsyncAPI document. | ||
|
||
**Default** expects `asyncapi.yml` in the root of the working directory. | ||
|
||
### `parameters` | ||
|
||
The template that you use might support and even require specific parameters to be passed to the template for the generation. | ||
|
||
### `output` | ||
|
||
Directory where to put the generated files. | ||
|
||
**Default** points to `output` directory in the working directory. | ||
|
||
## Outputs | ||
|
||
### `files` | ||
|
||
List of generated files. | ||
|
||
## Example usage | ||
|
||
### Basic | ||
|
||
In case all defaults are fine for you, just add such step: | ||
|
||
``` | ||
- name: Generating Markdown from my AsyncAPI document | ||
uses: asyncapi/[email protected] | ||
``` | ||
|
||
### Using all possible inputs | ||
|
||
In case you do not want to use defaults, you for example want to use different template: | ||
|
||
``` | ||
- name: Generating HTML from my AsyncAPI document | ||
uses: asyncapi/[email protected] | ||
with: | ||
template: '@asyncapi/html-template' #In case of template from npm, because of @ it must be in quotes | ||
filepath: docs/api/my-asyncapi.yml | ||
parameters: baseHref=/test-experiment/ sidebarOrganization=byTags #space separated list of key/values | ||
output: generated-html | ||
``` | ||
|
||
### Accessing output of generation step | ||
|
||
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: | ||
|
||
``` | ||
- name: Generating Markdown from my AsyncAPI document | ||
id: generation | ||
uses: asyncapi/[email protected] | ||
- 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 | ||
run: echo '${{steps.generation.outputs.files}}' | ||
``` | ||
|
||
### Example workflow with publishing generated HTML to GitHub Pages | ||
|
||
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: | ||
|
||
``` | ||
name: AsyncAPI documents processing | ||
on: | ||
push: | ||
branches: [ master ] | ||
jobs: | ||
generate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
#"standard step" where repo needs to be checked-out first | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
#Using another action for AsyncAPI for validation | ||
- name: Validating AsyncAPI document | ||
uses: WaleedAshraf/[email protected] | ||
with: | ||
filepath: docs/api/my-asyncapi.yml | ||
#In case you do not want to use defaults, you for example want to use different template | ||
- name: Generating HTML from my AsyncAPI document | ||
uses: asyncapi/[email protected] | ||
with: | ||
template: '@asyncapi/html-template' #In case of template from npm, because of @ it must be in quotes | ||
filepath: docs/api/my-asyncapi.yml | ||
parameters: baseHref=/test-experiment/ sidebarOrganization=byTags #space separated list of key/values | ||
output: generated-html | ||
#Using another action that takes generated HTML and pushes it to GH Pages | ||
- name: Deploy GH page | ||
uses: JamesIves/[email protected] | ||
with: | ||
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: gh-pages | ||
FOLDER: generated-html | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: 'Generator for AsyncAPI documents' | ||
description: 'Use this action to generate docs or code from your AsyncAPI document. Use default templates or provide your custom ones.' | ||
inputs: | ||
template: | ||
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.' | ||
default: '@asyncapi/markdown-template' | ||
required: false | ||
filepath: | ||
description: 'Location of the AsyncAPI document.' | ||
default: 'asyncapi.yml' | ||
required: false | ||
parameters: | ||
description: 'The template that you use might support and even require specific parameters to be passed to the template for the generation.' | ||
required: false | ||
output: | ||
description: 'Directory where to put the generated files.' | ||
required: false | ||
default: 'output' | ||
outputs: | ||
files: | ||
description: 'List of generated files.' | ||
runs: | ||
using: 'node12' | ||
main: 'dist/index.js' | ||
branding: | ||
icon: 'file-text' | ||
color: purple |
Binary file not shown.
Oops, something went wrong.