Skip to content

Commit

Permalink
Merge branch 'master-main' into feature/add_next_major
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Apr 6, 2022
2 parents 0fa0ed9 + 7c136e3 commit eace5dc
Show file tree
Hide file tree
Showing 28 changed files with 295 additions and 131 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/add-good-first-issue-labels.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,69 @@
#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:
types:
- 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 }}
Expand All @@ -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 }}
Expand All @@ -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']
})
6 changes: 3 additions & 3 deletions .github/workflows/automerge-for-humans-merging.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/automerge-orphans.yml
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand All @@ -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
Expand All @@ -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
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/autoupdate.yml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -19,14 +19,15 @@ on:
- 'all-contributors/**'

jobs:
autoupdate:
autoupdate-for-bot:
name: Autoupdate autoapproved PR created in the upstream
runs-on: ubuntu-latest
steps:
- name: Autoupdating
uses: docker://chinthakagodawita/autoupdate-action:v1
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"
17 changes: 9 additions & 8 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
5 changes: 3 additions & 2 deletions .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/if-go-pr-testing.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#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:
pull_request:
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')))"
Expand All @@ -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:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/if-nodejs-pr-testing.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#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:
pull_request:
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:
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/if-nodejs-release.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/if-nodejs-version-bump.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down
Loading

0 comments on commit eace5dc

Please sign in to comment.