diff --git a/.github/workflows/add-good-first-issue-labels.yml b/.github/workflows/add-good-first-issue-labels.yml index b9cdd0674..00acdb847 100644 --- a/.github/workflows/add-good-first-issue-labels.yml +++ b/.github/workflows/add-good-first-issue-labels.yml @@ -1,7 +1,7 @@ -#This workflow is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This workflow is centrally managed in https://github.com/asyncapi/.github/ +# 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 -#Purpose of this workflow is to enable anyone to label issue with 'Good First Issue' and 'area/*' with a single command. +# Purpose of this workflow is to enable anyone to label issue with 'Good First Issue' and 'area/*' with a single command. name: Add 'Good First Issue' and 'area/*' labels # if proper comment added on: diff --git a/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml b/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml index 68f396031..0a2e5d777 100644 --- a/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml +++ b/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml @@ -1,8 +1,11 @@ -#This workflow is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This workflow is centrally managed in https://github.com/asyncapi/.github/ +# 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 -#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 -name: Add ready-to-merge or do-not-merge label # if proper comment added +# Purpose of this workflow is to enable anyone to label PR with the following labels: +# `ready-to-merge` and `do-not-merge` labels to get stuff merged or blocked from merging +# `autoupdate` to keep a branch up-to-date with the target branch + +name: Label PRs # if proper comment added on: issue_comment: @@ -10,21 +13,57 @@ on: - created jobs: - parse-comment-and-add-ready: # for handling cases when you want to mark as ready to merge - if: github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot' + add-ready-to-merge-label: + if: > + github.event.issue.pull_request && + github.event.issue.state != 'closed' && + github.actor != 'asyncapi-bot' && + ( + contains(github.event.comment.body, '/ready-to-merge') || + contains(github.event.comment.body, '/rtm' ) + ) + runs-on: ubuntu-latest steps: - - name: Check if PR is draft # such info is not available in the context of issue_comment event + + - name: Check if PR is draft or is up-to-date # such info is not available in the context of issue_comment event uses: actions/github-script@v5 - id: checkDraft + id: checkPR with: result-encoding: string script: | + let isDraft = false; + let isUpToDate = true; const prDetailsUrl = context.payload.issue.pull_request.url; - const response = await github.request(prDetailsUrl); - return response.data.draft; - - name: Add label - if: steps.checkDraft.outputs.result == 'false' && (contains(github.event.comment.body, '/ready-to-merge') || contains(github.event.comment.body, '/rtm' )) + const { data: pull } = await github.request(prDetailsUrl); + isDraft = pull.draft; + + const { data: comparison } = + await github.rest.repos.compareCommitsWithBasehead({ + owner: pull.head.repo.owner.login, + repo: pull.head.repo.name, + basehead: `${pull.base.label}...${pull.head.label}`, + }); + if (comparison.behind_by !== 0) { + console.log(`This branch is behind the target by ${comparison.behind_by} commits`) + isUpToDate = false; + } else console.log(`This branch is up-to-date.`) + return { isDraft, isUpToDate }; + + - uses: actions-ecosystem/action-create-comment@v1 + if: ${{ !fromJson(steps.checkPR.outputs.result).isUpToDate }} + with: + github_token: ${{ secrets.GH_TOKEN }} + body: | + Hello, @${{ github.actor }}! 👋🏼 + This PR is not up to date with the base branch and can't be merged. + Please update your branch manually with the latest version of the base branch. + + PRO-TIP: Add a comment to your PR with the text: `/au` or `/autoupdate` and our bot will take care of updating the branch in the future. The only requirement for this to work is to enable [Allow edits from maintainers](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) option in your PR. + Thanks 😄 + + - name: Add ready-to-merge label + if: ${{ !fromJson(steps.checkPR.outputs.result).isDraft }} uses: actions/github-script@v5 with: github-token: ${{ secrets.GH_TOKEN }} @@ -36,12 +75,18 @@ jobs: labels: ['ready-to-merge'] }) - parse-comment-and-add-block: # for handling cases when you want to mark as do-not-merge - if: github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot' + add-do-not-merge-label: + if: > + github.event.issue.pull_request && + github.event.issue.state != 'closed' && + github.actor != 'asyncapi-bot' && + ( + contains(github.event.comment.body, '/do-not-merge') || + contains(github.event.comment.body, '/dnm' ) + ) runs-on: ubuntu-latest steps: - - name: Add label - if: contains(github.event.comment.body, '/do-not-merge') || contains(github.event.comment.body, '/dnm' ) + - name: Add do-not-merge label uses: actions/github-script@v5 with: github-token: ${{ secrets.GH_TOKEN }} @@ -51,4 +96,26 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, labels: ['do-not-merge'] + }) + add-autoupdate-label: + if: > + github.event.issue.pull_request && + github.event.issue.state != 'closed' && + github.actor != 'asyncapi-bot' && + ( + contains(github.event.comment.body, '/autoupdate') || + contains(github.event.comment.body, '/au' ) + ) + runs-on: ubuntu-latest + steps: + - name: Add autoupdate label + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.GH_TOKEN }} + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['autoupdate'] }) \ No newline at end of file diff --git a/.github/workflows/automerge-for-humans-merging.yml b/.github/workflows/automerge-for-humans-merging.yml index 37ee722fd..e1b4deb40 100644 --- a/.github/workflows/automerge-for-humans-merging.yml +++ b/.github/workflows/automerge-for-humans-merging.yml @@ -1,7 +1,7 @@ -#This workflow is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This workflow is centrally managed in https://github.com/asyncapi/.github/ +# 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 -#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! +# 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! name: Automerge For Humans on: diff --git a/.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml b/.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml index 3fe915797..f38296c8d 100644 --- a/.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml +++ b/.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml @@ -1,5 +1,5 @@ -#This workflow is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This workflow is centrally managed in https://github.com/asyncapi/.github/ +# 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 # Defence from evil contributor that after adding `ready-to-merge` all suddenly makes evil commit or evil change in PR title # Label is removed once above action is detected diff --git a/.github/workflows/automerge-orphans.yml b/.github/workflows/automerge-orphans.yml index 8b8c6c2dc..5c39ba921 100644 --- a/.github/workflows/automerge-orphans.yml +++ b/.github/workflows/automerge-orphans.yml @@ -1,5 +1,5 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 name: 'Notify on failing automerge' diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 2d0e1c71c..052a19c32 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -10,7 +10,8 @@ on: - synchronize jobs: - autoapprove: + autoapprove-for-bot: + name: Autoapprove PR comming from a bot if: > contains(fromJson('["asyncapi-bot", "dependabot[bot]", "dependabot-preview[bot]"]'), github.event.pull_request.user.login) && contains(fromJson('["asyncapi-bot", "dependabot[bot]", "dependabot-preview[bot]"]'), github.actor) && @@ -20,7 +21,7 @@ jobs: - name: Autoapproving uses: hmarr/auto-approve-action@v2 with: - github-token: "${{ secrets.GITHUB_TOKEN }}" + github-token: "${{ secrets.GH_TOKEN_BOT_EVE }}" - name: Label autoapproved uses: actions/github-script@v5 @@ -31,11 +32,12 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - labels: ['autoapproved'] + labels: ['autoapproved', 'autoupdate'] }) - automerge: - needs: [autoapprove] + automerge-for-bot: + name: Automerge PR autoapproved by a bot + needs: [autoapprove-for-bot] runs-on: ubuntu-latest steps: - name: Automerging diff --git a/.github/workflows/autoupdate.yml b/.github/workflows/autoupdate.yml index b8faa4280..f23ec3b88 100644 --- a/.github/workflows/autoupdate.yml +++ b/.github/workflows/autoupdate.yml @@ -1,12 +1,12 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 -#This workflow is designed to work with: +# This workflow is designed to work with: # - autoapprove and automerge workflows for dependabot and asyncapibot. # - 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 # It uses GitHub Action that auto-updates pull requests branches, whenever changes are pushed to their destination branch. -#Autoupdating to latest destination branch works only in the context of upstream repo and not forks +# Autoupdating to latest destination branch works only in the context of upstream repo and not forks name: autoupdate @@ -19,7 +19,8 @@ on: - 'all-contributors/**' jobs: - autoupdate: + autoupdate-for-bot: + name: Autoupdate autoapproved PR created in the upstream runs-on: ubuntu-latest steps: - name: Autoupdating @@ -27,6 +28,6 @@ jobs: env: GITHUB_TOKEN: '${{ secrets.GH_TOKEN }}' PR_FILTER: "labelled" - PR_LABELS: "autoapproved" + PR_LABELS: "autoupdate" PR_READY_STATE: "ready_for_review" MERGE_CONFLICT_ACTION: "ignore" diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index a6016b93b..68daa7c0c 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -1,20 +1,21 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 -#Purpose of this action is to update npm package in libraries that use it. It is like dependabot for asyncapi npm modules only. -#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 +# Purpose of this action is to update npm package in libraries that use it. It is like dependabot for asyncapi npm modules only. +# 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 name: Bump package version in dependent repos - if Node project on: - #It cannot run on release event as when release is created then version is not yet bumped in package.json - #This means we cannot extract easily latest version and have a risk that package is not yet on npm + # It cannot run on release event as when release is created then version is not yet bumped in package.json + # This means we cannot extract easily latest version and have a risk that package is not yet on npm push: branches: - master jobs: - bump: + bump-in-dependent-projects: + name: Bump this package in repositories that depend on it if: startsWith(github.event.commits[0].message, 'chore(release):') runs-on: ubuntu-latest steps: @@ -30,4 +31,4 @@ jobs: github_token: ${{ secrets.GH_TOKEN }} committer_username: asyncapi-bot committer_email: info@asyncapi.io - repos_to_ignore: html-template #this is temporary until react component releases 1.0, then it can be removed + repos_to_ignore: html-template # this is temporary until react component releases 1.0, then it can be removed diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index f9d477351..69163816e 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -1,5 +1,5 @@ -#This workflow is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This workflow is centrally managed in https://github.com/asyncapi/.github/ +# 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 name: Create help comment @@ -25,6 +25,7 @@ jobs: - `/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 - `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added + - `/autoupdate` or `/au` - This comment will add `autoupdate` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict. create_help_comment_issue: if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }} runs-on: ubuntu-latest diff --git a/.github/workflows/if-go-pr-testing.yml b/.github/workflows/if-go-pr-testing.yml index 8893baec8..606e689b3 100644 --- a/.github/workflows/if-go-pr-testing.yml +++ b/.github/workflows/if-go-pr-testing.yml @@ -1,6 +1,7 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 -#It does magic only if there is go.mod file in the root of the project +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 + +# It does magic only if there is go.mod file in the root of the project name: PR testing - if Go project on: @@ -8,8 +9,8 @@ on: types: [opened, reopened, synchronize, ready_for_review] jobs: - lint: - name: lint + lint-go-pr: + name: Lint Go PR runs-on: ubuntu-latest steps: - 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')))" @@ -35,8 +36,8 @@ jobs: with: skip-go-installation: true # we wanna control the version of Go in use - test: - name: ${{ matrix.os }} + test-go-pr: + name: Test Go PR - ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index 6a9ad91c3..1dcccd320 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -1,6 +1,7 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 -#It does magic only if there is package.json file in the root of the project +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 + +# It does magic only if there is package.json file in the root of the project name: PR testing - if Node project on: @@ -8,8 +9,8 @@ on: types: [opened, reopened, synchronize, ready_for_review] jobs: - test: - name: ${{ matrix.os }} + test-nodejs-pr: + name: Test NodeJS PR - ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/.github/workflows/if-nodejs-release.yml b/.github/workflows/if-nodejs-release.yml index 6cdfa8e56..bc5b53766 100644 --- a/.github/workflows/if-nodejs-release.yml +++ b/.github/workflows/if-nodejs-release.yml @@ -1,6 +1,7 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 -#It does magic only if there is package.json file in the root of the project +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 + +# It does magic only if there is package.json file in the root of the project name: Release - if Node project on: @@ -17,8 +18,8 @@ on: jobs: - test: - name: Test on ${{ matrix.os }} + test-nodejs: + name: Test NodeJS release on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -49,7 +50,7 @@ jobs: run: npm test release: - needs: test + needs: [test-nodejs] name: Publish to any of NPM, Github, and Docker Hub runs-on: ubuntu-latest steps: diff --git a/.github/workflows/if-nodejs-version-bump.yml b/.github/workflows/if-nodejs-version-bump.yml index c1f5c8603..721caa9d7 100644 --- a/.github/workflows/if-nodejs-version-bump.yml +++ b/.github/workflows/if-nodejs-version-bump.yml @@ -1,6 +1,7 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 -#It does magic only if there is package.json file in the root of the project +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 + +# It does magic only if there is package.json file in the root of the project name: Version bump - if Node.js project on: @@ -10,7 +11,7 @@ on: jobs: version_bump: - name: Generate assets and bump + name: Generate assets and bump NodeJS runs-on: ubuntu-latest steps: - name: Checkout repository diff --git a/.github/workflows/issues-prs-notifications.yml b/.github/workflows/issues-prs-notifications.yml index e9840d6e4..576b2bac8 100644 --- a/.github/workflows/issues-prs-notifications.yml +++ b/.github/workflows/issues-prs-notifications.yml @@ -1,7 +1,7 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 -#This action notifies community on slack whenever there is a new issue, PR or discussion started in given repository +# This action notifies community on slack whenever there is a new issue, PR or discussion started in given repository name: Notify slack on: @@ -19,7 +19,7 @@ jobs: issue: if: github.event_name == 'issues' && github.actor != 'asyncapi-bot' && github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' - name: On every new issue + name: Notify slack on every new issue runs-on: ubuntu-latest steps: - name: Convert markdown to slack markdown for issue @@ -31,13 +31,13 @@ jobs: uses: rtCamp/action-slack-notify@v2 env: SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}} - SLACK_TITLE: 🐛 New Issue 🐛 + SLACK_TITLE: 🐛 New Issue in ${{github.repository}} 🐛 SLACK_MESSAGE: ${{steps.issuemarkdown.outputs.text}} MSG_MINIMAL: true pull_request: if: github.event_name == 'pull_request_target' && github.actor != 'asyncapi-bot' && github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' - name: On every new pull request + name: Notify slack on every new pull request runs-on: ubuntu-latest steps: - name: Convert markdown to slack markdown for pull request @@ -49,13 +49,13 @@ jobs: uses: rtCamp/action-slack-notify@v2 env: SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}} - SLACK_TITLE: 💪 New Pull Request 💪 + SLACK_TITLE: 💪 New Pull Request in ${{github.repository}} 💪 SLACK_MESSAGE: ${{steps.prmarkdown.outputs.text}} MSG_MINIMAL: true discussion: if: github.event_name == 'discussion' && github.actor != 'asyncapi-bot' && github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' - name: On every new pull request + name: Notify slack on every new pull request runs-on: ubuntu-latest steps: - name: Convert markdown to slack markdown for pull request @@ -67,6 +67,6 @@ jobs: uses: rtCamp/action-slack-notify@v2 env: SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}} - SLACK_TITLE: 💬 New Discussion 💬 + SLACK_TITLE: 💬 New Discussion in ${{github.repository}} 💬 SLACK_MESSAGE: ${{steps.discussionmarkdown.outputs.text}} MSG_MINIMAL: true diff --git a/.github/workflows/link-check-cron.yml b/.github/workflows/link-check-cron.yml new file mode 100644 index 000000000..2b7038aeb --- /dev/null +++ b/.github/workflows/link-check-cron.yml @@ -0,0 +1,32 @@ +# This workflow is centrally managed in https://github.com/asyncapi/.github/ +# 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 + +name: Check Markdown links (Weekly) + +on: + workflow_dispatch: + schedule: + # At 00:00 UTC on every Monday + - cron: '0 0 * * 0' + +jobs: + External-link-validation-weekly: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + # Checks the status of hyperlinks in .md files + - name: Check links + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: 'yes' + use-verbose-mode: 'yes' + + - name: Report workflow run status to Slack + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,action,eventName,ref,workflow + env: + SLACK_DOCS_CHANNEL: ${{ secrets.SLACK_DOCS_CHANNEL }} + if: failure() # Only, on failure, send a message on the Slack Docs Channel (if there are broken links) diff --git a/.github/workflows/link-check-pr.yml b/.github/workflows/link-check-pr.yml new file mode 100644 index 000000000..2d7fec315 --- /dev/null +++ b/.github/workflows/link-check-pr.yml @@ -0,0 +1,20 @@ +# This workflow is centrally managed in https://github.com/asyncapi/.github/ +# 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 + +name: Check Markdown links + +on: + pull_request_target: + types: [synchronize, ready_for_review, opened, reopened] + +jobs: + External-link-validation-on-PR: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check links + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: 'yes' + use-verbose-mode: 'yes' + check-modified-files-only: 'yes' #Only modified files are checked on PRs diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index d9ea1e824..87e2fa5e7 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -1,5 +1,5 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 name: Lint PR title @@ -8,7 +8,8 @@ on: types: [opened, reopened, synchronize, edited, ready_for_review] jobs: - lint: + lint-pr-title: + name: Lint PR title runs-on: ubuntu-latest steps: # Since this workflow is REQUIRED for a PR to be mergable, we have to have this 'if' statement in step level instead of job level. diff --git a/.github/workflows/notify-tsc-members-mention.yml b/.github/workflows/notify-tsc-members-mention.yml index 5d342af81..e33b26251 100644 --- a/.github/workflows/notify-tsc-members-mention.yml +++ b/.github/workflows/notify-tsc-members-mention.yml @@ -1,7 +1,7 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 -#This action notifies community on slack whenever there is a new issue, PR or discussion started in given repository +# This action notifies community on slack whenever there is a new issue, PR or discussion started in given repository name: Notify slack whenever TSC members are mentioned in GitHub on: @@ -35,7 +35,7 @@ jobs: issue: if: github.event_name == 'issues' && contains(github.event.issue.body, '@asyncapi/tsc_members') - name: On every new issue + name: TSC notification on every new issue runs-on: ubuntu-latest steps: - name: Convert markdown to slack markdown @@ -53,7 +53,7 @@ jobs: pull_request: if: github.event_name == 'pull_request_target' && contains(github.event.pull_request.body, '@asyncapi/tsc_members') - name: On every new pull request + name: TSC notification on every new pull request runs-on: ubuntu-latest steps: - name: Convert markdown to slack markdown @@ -71,7 +71,7 @@ jobs: discussion: if: github.event_name == 'discussion' && contains(github.event.discussion.body, '@asyncapi/tsc_members') - name: On every new discussion + name: TSC notification on every new discussion runs-on: ubuntu-latest steps: - name: Convert markdown to slack markdown @@ -89,7 +89,7 @@ jobs: issue_comment: if: ${{ github.event_name == 'issue_comment' && !github.event.issue.pull_request && contains(github.event.comment.body, '@asyncapi/tsc_members') }} - name: On every new comment in issue + name: TSC notification on every new comment in issue runs-on: ubuntu-latest steps: - name: Convert markdown to slack markdown @@ -107,7 +107,7 @@ jobs: pr_comment: if: github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@asyncapi/tsc_members') - name: On every new comment in pr + name: TSC notification on every new comment in pr runs-on: ubuntu-latest steps: - name: Convert markdown to slack markdown @@ -125,7 +125,7 @@ jobs: discussion_comment: if: github.event_name == 'discussion_comment' && contains(github.event.comment.body, '@asyncapi/tsc_members') - name: On every new comment in discussion + name: TSC notification on every new comment in discussion runs-on: ubuntu-latest steps: - name: Convert markdown to slack markdown diff --git a/.github/workflows/release-announcements.yml b/.github/workflows/release-announcements.yml index 653ca2866..b2f3ba76d 100644 --- a/.github/workflows/release-announcements.yml +++ b/.github/workflows/release-announcements.yml @@ -1,5 +1,6 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 + name: 'Announce releases in different channels' on: @@ -9,7 +10,7 @@ on: jobs: - slack: + slack-announce: name: Slack - notify on every release runs-on: ubuntu-latest steps: @@ -26,7 +27,7 @@ jobs: SLACK_MESSAGE: ${{steps.markdown.outputs.text}} MSG_MINIMAL: true - twitter: + twitter-announce: name: Twitter - notify on minor and major releases runs-on: ubuntu-latest steps: diff --git a/.github/workflows/sentiment-analysis.yml b/.github/workflows/sentiment-analysis.yml index c1cde5c34..cd8ab05f7 100644 --- a/.github/workflows/sentiment-analysis.yml +++ b/.github/workflows/sentiment-analysis.yml @@ -1,5 +1,5 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 name: 'Sentiment Analysis' @@ -25,7 +25,7 @@ on: - created - edited jobs: - test: + sentiments: if: ${{ !contains(fromJson('["asyncapi-bot", "dependabot[bot]", "dependabot-preview[bot]", "allcontributors"]'), github.actor) }} name: Checking sentiments runs-on: ubuntu-latest diff --git a/.github/workflows/stale-issues-prs.yml b/.github/workflows/stale-issues-prs.yml index 57c0f1853..766731834 100644 --- a/.github/workflows/stale-issues-prs.yml +++ b/.github/workflows/stale-issues-prs.yml @@ -1,5 +1,5 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 name: Manage stale issues and PRs @@ -9,6 +9,7 @@ on: jobs: stale: + name: Mark issue or PR as stale runs-on: ubuntu-latest steps: - uses: actions/stale@v4.0.0 diff --git a/.github/workflows/welcome-first-time-contrib.yml b/.github/workflows/welcome-first-time-contrib.yml index e1a5faf04..e72fecef8 100644 --- a/.github/workflows/welcome-first-time-contrib.yml +++ b/.github/workflows/welcome-first-time-contrib.yml @@ -1,5 +1,5 @@ -#This action is centrally managed in https://github.com/asyncapi/.github/ -#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 +# This action is centrally managed in https://github.com/asyncapi/.github/ +# 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 name: Welcome first time contributors @@ -13,6 +13,7 @@ on: jobs: welcome: + name: Post welcome message if: ${{ !contains(fromJson('["asyncapi-bot", "dependabot[bot]", "dependabot-preview[bot]", "allcontributors"]'), github.actor) }} runs-on: ubuntu-latest steps: diff --git a/CODEOWNERS b/CODEOWNERS index 7c95a0f2a..ac61d1330 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -6,4 +6,4 @@ # The default owners are automatically added as reviewers when you open a pull request unless different owners are specified in the file. -* @fmvilas @derberg @magicmatatjahu @jonaslagoni @github-actions[bot] \ No newline at end of file +* @fmvilas @derberg @magicmatatjahu @jonaslagoni @asyncapi-bot-eve diff --git a/README.md b/README.md index d8e2157f2..6ed586598 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,4 @@ -
- Use your AsyncAPI definition to generate literally anything. Markdown documentation, Node.js code, HTML documentation, anything! -
+[![AsyncAPI Generator](./assets/readme-banner.png)](https://www.asyncapi.com/tools/generator) ![npm](https://img.shields.io/npm/v/@asyncapi/generator?style=for-the-badge) ![npm](https://img.shields.io/npm/dt/@asyncapi/generator?style=for-the-badge) @@ -62,6 +54,7 @@ Template Name | Description | Source code `@asyncapi/markdown-template` | Generates documentation in Markdown file | [click here](https://github.com/asyncapi/markdown-template) `@asyncapi/ts-nats-template` | Generates TypeScript NATS client | [click here](https://github.com/asyncapi/ts-nats-template/) `@asyncapi/go-watermill-template` | Generates Go client using Watermill | [click here](https://github.com/asyncapi/go-watermill-template) +`@asyncapi/dotnet-nats-template` | Generates .NET C# client using NATS | [click here](https://github.com/asyncapi/dotnet-nats-template) diff --git a/assets/readme-banner.png b/assets/readme-banner.png new file mode 100644 index 000000000..2543a7bc5 Binary files /dev/null and b/assets/readme-banner.png differ diff --git a/lib/utils.js b/lib/utils.js index a3be793dc..f345c4bc8 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -150,7 +150,12 @@ utils.registerSourceMap = () => { * @private */ utils.registerTypeScript = () => { - require('ts-node').register(); + const { REGISTER_INSTANCE, register } = require('ts-node'); + // if the ts-node has already been registered before, do not register it again. + if (process[REGISTER_INSTANCE]) { + return; + } + register(); }; /** diff --git a/package-lock.json b/package-lock.json index a7a9ebd17..6cb2f41b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@asyncapi/generator", - "version": "1.9.0", + "version": "1.9.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@asyncapi/generator", - "version": "1.8.27", + "version": "1.9.0", "license": "Apache-2.0", "dependencies": { "@asyncapi/avro-schema-parser": "^1.0.0", @@ -32,7 +32,7 @@ "resolve-from": "^5.0.0", "resolve-pkg": "^2.0.0", "semver": "^7.3.2", - "simple-git": "^1.131.0", + "simple-git": "^3.3.0", "source-map-support": "^0.5.19", "ts-node": "^9.1.1", "typescript": "^4.2.2" @@ -4590,6 +4590,19 @@ "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==" }, + "node_modules/@kwsites/file-exists": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", + "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", + "dependencies": { + "debug": "^4.1.1" + } + }, + "node_modules/@kwsites/promise-deferred": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz", + "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==" + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", @@ -7221,9 +7234,9 @@ } }, "node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dependencies": { "ms": "2.1.2" }, @@ -20247,11 +20260,17 @@ } }, "node_modules/simple-git": { - "version": "1.132.0", - "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-1.132.0.tgz", - "integrity": "sha512-xauHm1YqCTom1sC9eOjfq3/9RKiUA9iPnxBbrY2DdL8l4ADMu0jjM5l5lphQP5YWNqAL2aXC/OeuQ76vHtW5fg==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.3.0.tgz", + "integrity": "sha512-K9qcbbZwPHhk7MLi0k0ekvSFXJIrRoXgHhqMXAFM75qS68vdHTcuzmul1ilKI02F/4lXshVgBoDll2t++JK0PQ==", "dependencies": { - "debug": "^4.0.1" + "@kwsites/file-exists": "^1.1.1", + "@kwsites/promise-deferred": "^1.1.1", + "debug": "^4.3.3" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/steveukx/" } }, "node_modules/sisteransi": { @@ -25672,6 +25691,19 @@ "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==" }, + "@kwsites/file-exists": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", + "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", + "requires": { + "debug": "^4.1.1" + } + }, + "@kwsites/promise-deferred": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz", + "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==" + }, "@nodelib/fs.scandir": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", @@ -27796,9 +27828,9 @@ "dev": true }, "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "requires": { "ms": "2.1.2" } @@ -37843,11 +37875,13 @@ } }, "simple-git": { - "version": "1.132.0", - "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-1.132.0.tgz", - "integrity": "sha512-xauHm1YqCTom1sC9eOjfq3/9RKiUA9iPnxBbrY2DdL8l4ADMu0jjM5l5lphQP5YWNqAL2aXC/OeuQ76vHtW5fg==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.3.0.tgz", + "integrity": "sha512-K9qcbbZwPHhk7MLi0k0ekvSFXJIrRoXgHhqMXAFM75qS68vdHTcuzmul1ilKI02F/4lXshVgBoDll2t++JK0PQ==", "requires": { - "debug": "^4.0.1" + "@kwsites/file-exists": "^1.1.1", + "@kwsites/promise-deferred": "^1.1.1", + "debug": "^4.3.3" } }, "sisteransi": { diff --git a/package.json b/package.json index ec2e3a983..3b2493e0d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@asyncapi/generator", - "version": "1.9.0", + "version": "1.9.1", "description": "The AsyncAPI generator. It can generate documentation, code, anything!", "main": "./lib/generator.js", "bin": { @@ -71,7 +71,7 @@ "resolve-from": "^5.0.0", "resolve-pkg": "^2.0.0", "semver": "^7.3.2", - "simple-git": "^1.131.0", + "simple-git": "^3.3.0", "source-map-support": "^0.5.19", "ts-node": "^9.1.1", "typescript": "^4.2.2"