From c5239cab207e1105a98047d795cd681c18bffa6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20M=C3=A9ndez?= Date: Thu, 1 Feb 2024 12:47:53 +0100 Subject: [PATCH 01/18] chore: remove me as maintainer (#270) --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index c057e9e0..86c9a183 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. -* @derberg @alequetzalli @fmvilas @KhudaDad414 @asyncapi-bot-eve \ No newline at end of file +* @derberg @alequetzalli @KhudaDad414 @asyncapi-bot-eve From a10768b271e487a0158bcb550fdff8ff926ceb97 Mon Sep 17 00:00:00 2001 From: Tamal Das Date: Wed, 21 Feb 2024 20:07:36 +0530 Subject: [PATCH 02/18] feat: upgrades to issue templates (#217) Co-authored-by: Khuda Dad Nomani <32505158+KhudaDad414@users.noreply.github.com>%0ACo-authored-by: Alejandra Quetzalli %0ACo-authored-by: Lukasz Gornicki --- .github/ISSUE_TEMPLATE/bug.md | 18 ------ .github/ISSUE_TEMPLATE/bug.yml | 83 ++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/enhancement.md | 18 ------ .github/ISSUE_TEMPLATE/enhancement.yml | 70 ++++++++++++++++++++++ 4 files changed, 153 insertions(+), 36 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug.md create mode 100644 .github/ISSUE_TEMPLATE/bug.yml delete mode 100644 .github/ISSUE_TEMPLATE/enhancement.md create mode 100644 .github/ISSUE_TEMPLATE/enhancement.yml diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md deleted file mode 100644 index 665a150b..00000000 --- a/.github/ISSUE_TEMPLATE/bug.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Bug report -about: Report a bug so we can fix and improve -labels: bug ---- - -#### Describe the bug -A clear and concise description of what the bug is. - -#### How to Reproduce -Steps to reproduce the issue. Attach all resources that can help us understand the issue: - -- Screenshots -- Link to GitHub repository with project that has issues -- Files that can help reproduce the issue, like your AsyncAPI file, either paste inside the issue in a code block or in a sharable [gist](https://gist.github.com/) - -#### Expected behavior -A clear and concise description of what you expected to happen. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 00000000..0334900f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,83 @@ +name: 🐛 Bug Report +description: Report bugs to fix and improve. +title: "[BUG] " +labels: ["bug"] + + +body: + - type: textarea + id: description + attributes: + label: Describe the bug. + description: A clear and concise description of what the bug is. + validations: + required: true + + - type: textarea + id: expected + attributes: + label: Expected behavior + description: A clear and concise description of what you expected to happen. + validations: + required: true + + + - type: textarea + id: screenshots + attributes: + label: Screenshots + description: Please add screenshots/video of the bug you faced. + validations: + required: true + + - type: textarea + id: reproduce + attributes: + label: How to Reproduce + description: Attach all steps/share a github gist that can help anyone reproduce the bug. + value: | + 1. I first did this + 2. I then did this + 3. And so on . . . + validations: + required: true + + - type: dropdown + id: browser + attributes: + label: "🥦 Browser" + description: "What browser are you using?" + options: + - Google Chrome + - Brave + - Microsoft Edge + - Mozilla Firefox + - Safari + - Opera + - Other + validations: + required: optional + + - type: checkboxes + id: no-duplicate-issues + attributes: + label: "👀 Have you checked for similar open issues?" + options: + - label: "I checked and didn't find similar issue" + required: true + + - type: checkboxes + id: read-code-of-conduct + attributes: + label: "🏢 Have you read the Contributing Guidelines?" + options: + - label: "I have read the [Contributing Guidelines](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING.md)" + required: true + + - type: dropdown + attributes: + label: Are you willing to work on this issue ? + description: This is absolutely not required, but we are happy to guide you in the contribution process. + options: + - "Yes I am willing to submit a PR!" + - "No, someone else can work on it" \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/enhancement.md b/.github/ISSUE_TEMPLATE/enhancement.md deleted file mode 100644 index 92cbf241..00000000 --- a/.github/ISSUE_TEMPLATE/enhancement.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Feature request -about: Suggest how we can improve -labels: enhancement ---- - -#### Reason/Context -Please try answering few of those questions -- Why we need this improvement? -- How will this change help? -- What is the motivation? - - -#### Description -Please try answering few of those questions -- What changes have to be introduced? -- Will this be a breaking change? -- How could it be implemented/designed? diff --git a/.github/ISSUE_TEMPLATE/enhancement.yml b/.github/ISSUE_TEMPLATE/enhancement.yml new file mode 100644 index 00000000..255b6d92 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/enhancement.yml @@ -0,0 +1,70 @@ +name: 💡 Feature Request +description: Suggest a new idea/feature +title: "[FEATURE] " +labels: ["enhancement"] + +body: + - type: textarea + id: need_improvement + attributes: + label: Why do we need this improvement? + validations: + required: true + + - type: textarea + id: change + attributes: + label: How will this change help? + validations: + required: true + + - type: textarea + id: screenshots + attributes: + label: Screenshots + description: Please add screenshots if applicable + validations: + required: false + + + - type: textarea + id: implemented + attributes: + label: How could it be implemented/designed? + validations: + required: true + + - type: dropdown + id: breakingchange + attributes: + label: "🚧 Breaking changes" + description: "Will this be a breaking change?" + options: + - "Yes" + - "No" + validations: + required: true + + - type: checkboxes + id: no-duplicate-issues + attributes: + label: "👀 Have you checked for similar open issues?" + options: + - label: "I checked and didn't find a similar issue" + required: true + + - type: checkboxes + id: read-code-of-conduct + attributes: + label: "🏢 Have you read the Contributing Guidelines?" + options: + - label: "I have read the [Contributing Guidelines](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING.md)" + required: true + + - type: dropdown + attributes: + label: Are you willing to work on this issue? + description: This is absolutely not required, but we are happy to guide you in the contribution process. + options: + - "Yes I am willing to submit a PR!" + - "No, someone else can work on it." \ No newline at end of file From 09d72fb0774103e4fd36b81cfac1d15f8a3fbba7 Mon Sep 17 00:00:00 2001 From: pavanydg <113893382+pavanydg@users.noreply.github.com> Date: Mon, 26 Feb 2024 22:34:12 +0530 Subject: [PATCH 03/18] fix: changed required from optional to false in bug.yml (#273) --- .github/ISSUE_TEMPLATE/bug.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 0334900f..76528d5d 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -56,7 +56,7 @@ body: - Opera - Other validations: - required: optional + required: false - type: checkboxes id: no-duplicate-issues From 155450c63b21dcf4a7f7b7ef926333f185637a95 Mon Sep 17 00:00:00 2001 From: Ashish Padhy <100484401+Shurtu-gal@users.noreply.github.com> Date: Tue, 12 Mar 2024 02:41:33 +0530 Subject: [PATCH 04/18] chore: add saunter to ignored repos list (#276) --- .github/workflows/bump.yml | 2 +- .github/workflows/global-remover.yml | 2 +- .github/workflows/global-replicator.yml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index e5f8351a..0cca033d 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -31,4 +31,4 @@ jobs: github_token: ${{ secrets.GH_TOKEN }} committer_username: asyncapi-bot committer_email: info@asyncapi.io - repos_to_ignore: spec,bindings + repos_to_ignore: spec,bindings,saunter diff --git a/.github/workflows/global-remover.yml b/.github/workflows/global-remover.yml index b48707d0..d1347fe4 100644 --- a/.github/workflows/global-remover.yml +++ b/.github/workflows/global-remover.yml @@ -49,5 +49,5 @@ jobs: committer_username: asyncapi-bot committer_email: info@asyncapi.io commit_message: "ci: update of files from global .github repo" - repos_to_ignore: shape-up-process,glee-hello-world + repos_to_ignore: shape-up-process,glee-hello-world,saunter bot_branch_name: bot/update-files-from-global-repo \ No newline at end of file diff --git a/.github/workflows/global-replicator.yml b/.github/workflows/global-replicator.yml index 57cadda4..6bb8edda 100644 --- a/.github/workflows/global-replicator.yml +++ b/.github/workflows/global-replicator.yml @@ -28,7 +28,7 @@ jobs: with: github_token: ${{ secrets.GH_TOKEN }} patterns_to_include: CODE_OF_CONDUCT.md - repos_to_ignore: shape-up-process,glee-hello-world + repos_to_ignore: shape-up-process,glee-hello-world,saunter committer_username: asyncapi-bot committer_email: info@asyncapi.io commit_message: "ci: update of files from global .github repo" @@ -46,7 +46,7 @@ jobs: with: github_token: ${{ secrets.GH_TOKEN }} patterns_to_include: CONTRIBUTING.md - repos_to_ignore: shape-up-process,glee-hello-world,spec,community,php-template,tck,modelina,dotnet-nats-template,ts-nats-template,extensions-catalog + repos_to_ignore: shape-up-process,glee-hello-world,spec,community,php-template,tck,modelina,dotnet-nats-template,ts-nats-template,extensions-catalog,saunter committer_username: asyncapi-bot committer_email: info@asyncapi.io commit_message: "ci: update of files from global .github repo" @@ -142,7 +142,7 @@ jobs: committer_username: asyncapi-bot committer_email: info@asyncapi.io commit_message: "ci: update of files from global .github repo" - repos_to_ignore: shape-up-process,glee-hello-world + repos_to_ignore: shape-up-process,glee-hello-world,saunter bot_branch_name: bot/update-files-from-global-repo replicate_docker_workflows: From 2d7c44367bfd3ae2df411e47f246e6d421656394 Mon Sep 17 00:00:00 2001 From: Ashish Padhy <100484401+Shurtu-gal@users.noreply.github.com> Date: Tue, 12 Mar 2024 02:43:08 +0530 Subject: [PATCH 05/18] chore: bump commit ref in `npm-dependency-manger` to latest (#274) Co-authored-by: Lukasz Gornicki --- .github/workflows/bump.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index 0cca033d..dff50cfa 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -26,7 +26,7 @@ jobs: run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT - if: steps.packagejson.outputs.exists == 'true' name: Bumping latest version of this package in other repositories - uses: derberg/npm-dependency-manager-for-your-github-org@26a4f13d740254719971325046822a169aaa7441 # using v5.-.- https://github.com/derberg/npm-dependency-manager-for-your-github-org/releases/tag/v5.0.0 + uses: derberg/npm-dependency-manager-for-your-github-org@3df56be95bcaa5c76a9c9a4af863ab151545b649 # using v6.-.- https://github.com/derberg/npm-dependency-manager-for-your-github-org/releases/tag/v6 with: github_token: ${{ secrets.GH_TOKEN }} committer_username: asyncapi-bot From 3b278694c3d0850004e1e0e458779252195a5058 Mon Sep 17 00:00:00 2001 From: Animesh Kumar Date: Tue, 12 Mar 2024 02:56:07 +0530 Subject: [PATCH 06/18] fix: add `.prettierignore` to disable auto-formatting issue across all repositories (#253) Co-authored-by: Lukasz Gornicki --- .github/workflows/.prettierignore | 1 + .github/workflows/global-replicator.yml | 38 ++++++++++++++++++------- README.md | 5 ++-- 3 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/.prettierignore diff --git a/.github/workflows/.prettierignore b/.github/workflows/.prettierignore new file mode 100644 index 00000000..fa29cdff --- /dev/null +++ b/.github/workflows/.prettierignore @@ -0,0 +1 @@ +** \ No newline at end of file diff --git a/.github/workflows/global-replicator.yml b/.github/workflows/global-replicator.yml index 6bb8edda..0bd430fb 100644 --- a/.github/workflows/global-replicator.yml +++ b/.github/workflows/global-replicator.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Replicating file uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Replicating file uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: @@ -58,7 +58,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Replicating file uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: @@ -76,7 +76,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Replicating file uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: @@ -94,7 +94,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Replicating file uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: @@ -114,7 +114,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Replicating file uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: @@ -133,7 +133,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Replicating file uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: @@ -151,7 +151,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Replicating file uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: @@ -169,7 +169,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Replicating file uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: @@ -197,4 +197,22 @@ jobs: committer_username: asyncapi-bot committer_email: info@asyncapi.io commit_message: "ci: update of files from global .github repo" - bot_branch_name: bot/update-files-from-global-repo/${{ github.job }} \ No newline at end of file + bot_branch_name: bot/update-files-from-global-repo/${{ github.job }} + + replicate_prettierignore_file: + if: startsWith(github.repository, 'asyncapi/') + name: Replicate .prettierignore file in the required repositories + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Replicating file + uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 + with: + github_token: ${{ secrets.GH_TOKEN }} + patterns_to_include: .prettierignore + topics_to_include: get-global-prettierignore + committer_username: asyncapi-bot + committer_email: info@asyncapi.io + commit_message: "ci: update .prettierignore from global .github repo" + bot_branch_name: bot/update-files-from-global-repo \ No newline at end of file diff --git a/README.md b/README.md index ec45768d..31c926db 100644 --- a/README.md +++ b/README.md @@ -13,5 +13,6 @@ Below is a list of workflows with their corresponding topics and descriptions. B | `golang` | [if-go-pr-testing](.github/workflows/if-go-pr-testing.yml) | Compiles and tests Go code using multiple versions of Go | `nodejs` | [if-nodejs-pr-testing](.github/workflows/if-nodejs-pr-testing.yml) | Builds and tests Node.js projects using multiple Node.js versions | `get-global-node-release-workflows` | [if-nodejs-release](.github/workflows/if-nodejs-release.yml), [if-nodejs-version-bump.yml](.github/workflows/if-nodejs-version-bump.yml) , [bump.yml](.github/workflows/bump.yml) | Fetches and publishes Node.js release information to the project's website -| `get-global-releaserc` | [.releaserc](.github/workflows/.releaserc) | Fetches release configuration files from a remote repository and makes them available to other workflows -| `get-global-docs-autoupdate` | [update-docs-on-docs-commits](.github/workflows/update-docs-on-docs-commits.yml) | Updates the documentation of a project using `generate:assets` command (if it exists) when the commit starts with `docs:` \ No newline at end of file +| `get-global-releaserc` | [.releaserc](.github/workflows/.releaserc) | Fetches release configuration files from a remote repository andUpdates the documentation of a project using `generate:assets` command (if it exists) when the commit starts with `docs makes them available to other workflows +| `get-global-docs-autoupdate` | [update-docs-on-docs-commits](.github/workflows/update-docs-on-docs-commits.yml) | Updates the documentation of a project using `generate:assets` command (if it exists) when the commit starts with `docs:` +| `get-global-prettierignore` | [replicate-prettierignore-file](./.github/workflows/global-replicator.yml#L202C3-L218C61) | Replicates `.prettierignore` file in the repository which has this topic. \ No newline at end of file From 703ea72bb92c214b226ecb1484df21a23f835c8d Mon Sep 17 00:00:00 2001 From: Viacheslav Turovskyi Date: Mon, 18 Mar 2024 10:21:21 +0200 Subject: [PATCH 07/18] ci: add workflow for the Bounty Program commands (#277) --- .github/workflows/bounty-program-commands.yml | 90 +++++++++++++++++++ .github/workflows/global-replicator.yml | 2 +- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/bounty-program-commands.yml diff --git a/.github/workflows/bounty-program-commands.yml b/.github/workflows/bounty-program-commands.yml new file mode 100644 index 00000000..433f7d95 --- /dev/null +++ b/.github/workflows/bounty-program-commands.yml @@ -0,0 +1,90 @@ +# This workflow is centrally managed at https://github.com/asyncapi/.github/ +# Don't make changes to this file in this repository, as they will be overwritten with +# changes made to the same file in the abovementioned repository. + +# The purpose of this workflow is to allow Bounty Team members +# (https://github.com/orgs/asyncapi/teams/bounty_team) to issue commands to the +# organization's global AsyncAPI bot related to the Bounty Program, while at the +# same time preventing unauthorized users from misusing them. + +name: Bounty Program commands + +on: + issue_comment: + types: + - created + +jobs: + guard-against-unauthorized-use: + if: > + github.actor != ('aeworxet' || 'thulieblack') && + ( + contains(github.event.comment.body, '/bounty' ) + ) + + runs-on: ubuntu-latest + + steps: + - name: ❌ @${{github.actor}} made an unauthorized attempt to use a Bounty Program's command + uses: actions/github-script@v6 + + with: + github-token: ${{ secrets.GH_TOKEN }} + script: | + const commentText = `❌ @${{github.actor}} is not authorized to use the Bounty Program's commands. + These commands can only be used by members of the [Bounty Team](https://github.com/orgs/asyncapi/teams/bounty_team).`; + + console.log(`❌ @${{github.actor}} made an unauthorized attempt to use a Bounty Program's command.`); + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: commentText + }) + + add-label-bounty: + if: > + github.actor == ('aeworxet' || 'thulieblack') && + ( + contains(github.event.comment.body, '/bounty' ) + ) + + runs-on: ubuntu-latest + env: + BOUNTY_PROGRAM_LABELS_JSON: | + [ + {"name": "bounty", "color": "0e8a16", "description": "Participation in the Bounty Program"} + ] + + steps: + - name: Add label `bounty` + uses: actions/github-script@v6 + + with: + github-token: ${{ secrets.GH_TOKEN }} + script: | + const BOUNTY_PROGRAM_LABELS = JSON.parse(process.env.BOUNTY_PROGRAM_LABELS_JSON); + let LIST_OF_LABELS_FOR_REPO = await github.rest.issues.listLabelsForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + }); + + LIST_OF_LABELS_FOR_REPO = LIST_OF_LABELS_FOR_REPO.data.map(key => key.name); + + if (!LIST_OF_LABELS_FOR_REPO.includes(BOUNTY_PROGRAM_LABELS[0].name)) { + await github.rest.issues.createLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: BOUNTY_PROGRAM_LABELS[0].name, + color: BOUNTY_PROGRAM_LABELS[0].color, + description: BOUNTY_PROGRAM_LABELS[0].description + }); + } + + console.log('Adding label `bounty`...'); + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: [BOUNTY_PROGRAM_LABELS[0].name] + }) diff --git a/.github/workflows/global-replicator.yml b/.github/workflows/global-replicator.yml index 0bd430fb..e61741c2 100644 --- a/.github/workflows/global-replicator.yml +++ b/.github/workflows/global-replicator.yml @@ -138,7 +138,7 @@ jobs: uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: github_token: ${{ secrets.GH_TOKEN }} - patterns_to_include: .github/workflows/scripts,.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml,.github/workflows/add-good-first-issue-labels.yml,.github/workflows/automerge-for-humans-merging.yml,.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml,.github/workflows/automerge-orphans.yml,.github/workflows/automerge.yml,.github/workflows/autoupdate.yml,.github/workflows/help-command.yml,.github/workflows/issues-prs-notifications.yml,.github/workflows/lint-pr-title.yml,.github/workflows/notify-tsc-members-mention.yml,.github/workflows/stale-issues-prs.yml,.github/workflows/welcome-first-time-contrib.yml,.github/workflows/release-announcements.yml + patterns_to_include: .github/workflows/scripts,.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml,.github/workflows/add-good-first-issue-labels.yml,.github/workflows/automerge-for-humans-merging.yml,.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml,.github/workflows/automerge-orphans.yml,.github/workflows/automerge.yml,.github/workflows/autoupdate.yml,.github/workflows/help-command.yml,.github/workflows/issues-prs-notifications.yml,.github/workflows/lint-pr-title.yml,.github/workflows/notify-tsc-members-mention.yml,.github/workflows/stale-issues-prs.yml,.github/workflows/welcome-first-time-contrib.yml,.github/workflows/release-announcements.yml,.github/workflows/bounty-program-commands.yml committer_username: asyncapi-bot committer_email: info@asyncapi.io commit_message: "ci: update of files from global .github repo" From f9776eda158147edbfd7e59512b3df9d68aa35c3 Mon Sep 17 00:00:00 2001 From: Lukasz Gornicki Date: Tue, 2 Apr 2024 20:42:08 +0200 Subject: [PATCH 08/18] ci: fix windows issues in few workflows (#280) --- .github/workflows/if-go-pr-testing.yml | 2 ++ .github/workflows/if-nodejs-pr-testing.yml | 5 +++-- .github/workflows/if-nodejs-release.yml | 10 +++++++++- .github/workflows/if-nodejs-version-bump.yml | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/if-go-pr-testing.yml b/.github/workflows/if-go-pr-testing.yml index 58e3b2b7..ca29021f 100644 --- a/.github/workflows/if-go-pr-testing.yml +++ b/.github/workflows/if-go-pr-testing.yml @@ -30,6 +30,7 @@ jobs: id: should_run name: Should Run run: echo "shouldrun=true" >> $GITHUB_OUTPUT + shell: bash - if: steps.should_run.outputs.shouldrun == 'true' name: Checkout repository uses: actions/checkout@v3 @@ -74,6 +75,7 @@ jobs: id: should_run name: Should Run run: echo "shouldrun=true" >> $GITHUB_OUTPUT + shell: bash - if: steps.should_run.outputs.shouldrun == 'true' name: Checkout repository uses: actions/checkout@v3 diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index 9ce9f9a1..75eaaac7 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -33,6 +33,7 @@ jobs: id: should_run name: Should Run run: echo "shouldrun=true" >> $GITHUB_OUTPUT + shell: bash - if: steps.should_run.outputs.shouldrun == 'true' name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows run: | @@ -60,13 +61,13 @@ jobs: - if: steps.packagejson.outputs.exists == 'true' name: Install dependencies id: first-installation - run: npm install --loglevel verbose + run: npm ci continue-on-error: true - if: steps.first-installation.outputs.status == 'failure' && steps.packagejson.outputs.exists == 'true' name: Clear NPM cache and install deps again run: | npm cache clean --force - npm install --loglevel verbose + npm ci - if: steps.packagejson.outputs.exists == 'true' name: Test run: npm test --if-present diff --git a/.github/workflows/if-nodejs-release.yml b/.github/workflows/if-nodejs-release.yml index 4938a37d..fbad21df 100644 --- a/.github/workflows/if-nodejs-release.yml +++ b/.github/workflows/if-nodejs-release.yml @@ -85,6 +85,7 @@ jobs: - name: Check if Node.js project and has package.json id: packagejson run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT + shell: bash - if: steps.packagejson.outputs.exists == 'true' name: Check package-lock version uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master @@ -98,7 +99,14 @@ jobs: cache-dependency-path: '**/package-lock.json' - if: steps.packagejson.outputs.exists == 'true' name: Install dependencies - run: npm install + id: first-installation + run: npm ci + continue-on-error: true + - if: steps.first-installation.outputs.status == 'failure' && steps.packagejson.outputs.exists == 'true' + name: Clear NPM cache and install deps again + run: | + npm cache clean --force + npm ci - if: steps.packagejson.outputs.exists == 'true' name: Add plugin for conventional commits for semantic-release run: npm install --save-dev conventional-changelog-conventionalcommits@5.0.0 diff --git a/.github/workflows/if-nodejs-version-bump.yml b/.github/workflows/if-nodejs-version-bump.yml index 7e27f90b..36847d80 100644 --- a/.github/workflows/if-nodejs-version-bump.yml +++ b/.github/workflows/if-nodejs-version-bump.yml @@ -37,7 +37,7 @@ jobs: cache-dependency-path: '**/package-lock.json' - if: steps.packagejson.outputs.exists == 'true' name: Install dependencies - run: npm install + run: npm ci - if: steps.packagejson.outputs.exists == 'true' name: Assets generation run: npm run generate:assets --if-present From bf6ed7dd3feda8f658ab69ed7b50e376cc302ce4 Mon Sep 17 00:00:00 2001 From: Priyansh Mehta <96513964+Priyansh61@users.noreply.github.com> Date: Wed, 3 Apr 2024 00:37:06 +0530 Subject: [PATCH 09/18] ci: added ping-for-attention command to notify the reviewers (#239) Co-authored-by: Khuda Dad Nomani <32505158+KhudaDad414@users.noreply.github.com> --- .github/workflows/global-replicator.yml | 2 +- .github/workflows/help-command.yml | 1 + .../workflows/please-take-a-look-command.yml | 54 +++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/please-take-a-look-command.yml diff --git a/.github/workflows/global-replicator.yml b/.github/workflows/global-replicator.yml index e61741c2..2e66ff04 100644 --- a/.github/workflows/global-replicator.yml +++ b/.github/workflows/global-replicator.yml @@ -138,7 +138,7 @@ jobs: uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: github_token: ${{ secrets.GH_TOKEN }} - patterns_to_include: .github/workflows/scripts,.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml,.github/workflows/add-good-first-issue-labels.yml,.github/workflows/automerge-for-humans-merging.yml,.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml,.github/workflows/automerge-orphans.yml,.github/workflows/automerge.yml,.github/workflows/autoupdate.yml,.github/workflows/help-command.yml,.github/workflows/issues-prs-notifications.yml,.github/workflows/lint-pr-title.yml,.github/workflows/notify-tsc-members-mention.yml,.github/workflows/stale-issues-prs.yml,.github/workflows/welcome-first-time-contrib.yml,.github/workflows/release-announcements.yml,.github/workflows/bounty-program-commands.yml + patterns_to_include: .github/workflows/scripts,.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml,.github/workflows/add-good-first-issue-labels.yml,.github/workflows/automerge-for-humans-merging.yml,.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml,.github/workflows/automerge-orphans.yml,.github/workflows/automerge.yml,.github/workflows/autoupdate.yml,.github/workflows/help-command.yml,.github/workflows/issues-prs-notifications.yml,.github/workflows/lint-pr-title.yml,.github/workflows/notify-tsc-members-mention.yml,.github/workflows/stale-issues-prs.yml,.github/workflows/welcome-first-time-contrib.yml,.github/workflows/release-announcements.yml,.github/workflows/bounty-program-commands.yml,.github/workflows/please-take-a-look-command.yml committer_username: asyncapi-bot committer_email: info@asyncapi.io commit_message: "ci: update of files from global .github repo" diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index d4ba4a44..ada81682 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -31,6 +31,7 @@ jobs: At the moment the following comments are supported in pull requests: + - \`/please-take-a-look` or \`/ptal\` - This comment will add a comment to the PR asking for attention from the reviewrs who have not reviewed the PR yet. - \`/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 or it is a draft PR.` diff --git a/.github/workflows/please-take-a-look-command.yml b/.github/workflows/please-take-a-look-command.yml new file mode 100644 index 00000000..216055ca --- /dev/null +++ b/.github/workflows/please-take-a-look-command.yml @@ -0,0 +1,54 @@ +# 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 uses Github actions to listen for comments on issues and pull requests and +# if the comment contains /ping-for-attention or /pfa it will add a comment pinging +# the code-owners who have not yet reviewed the pull request + +name: Please take a Look + +on: + issue_comment: + types: [created] + +jobs: + ping-for-attention: + if: > + github.event.issue.pull_request && + github.event.issue.state != 'closed' && + github.actor != 'asyncapi-bot' && + ( + contains(github.event.comment.body, '/please-take-a-look') || + contains(github.event.comment.body, '/ptal') || + contains(github.event.comment.body, '/PTAL') + ) + runs-on: ubuntu-latest + steps: + - name: Check for Please Take a Look Command + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GH_TOKEN }} + script: | + const prDetailsUrl = context.payload.issue.pull_request.url; + const { data: pull } = await github.request(prDetailsUrl); + const reviewers = pull.requested_reviewers.map(reviewer => reviewer.login); + + const { data: reviews } = await github.rest.pulls.listReviews({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number + }); + + const reviewersWhoHaveReviewed = reviews.map(review => review.user.login); + + const reviewersWhoHaveNotReviewed = reviewers.filter(reviewer => !reviewersWhoHaveReviewed.includes(reviewer)); + + if (reviewersWhoHaveNotReviewed.length > 0) { + const comment = reviewersWhoHaveNotReviewed.map(reviewer => `@${reviewer}`).join(' '); + await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `${comment} Please take a look at this PR. Thanks! :wave:` + }); + } From 9c4f1b1100b1508703d9fdc841fcafaa6d85ac3a Mon Sep 17 00:00:00 2001 From: Lukasz Gornicki Date: Wed, 3 Apr 2024 20:10:08 +0200 Subject: [PATCH 10/18] ci: fix reinstallation of failure in release and pr testing (#281) --- .github/workflows/if-nodejs-pr-testing.yml | 2 +- .github/workflows/if-nodejs-release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index 75eaaac7..73a2af5c 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -63,7 +63,7 @@ jobs: id: first-installation run: npm ci continue-on-error: true - - if: steps.first-installation.outputs.status == 'failure' && steps.packagejson.outputs.exists == 'true' + - if: steps.first-installation.outcome != 'success' && steps.packagejson.outputs.exists == 'true' name: Clear NPM cache and install deps again run: | npm cache clean --force diff --git a/.github/workflows/if-nodejs-release.yml b/.github/workflows/if-nodejs-release.yml index fbad21df..f407e59a 100644 --- a/.github/workflows/if-nodejs-release.yml +++ b/.github/workflows/if-nodejs-release.yml @@ -102,7 +102,7 @@ jobs: id: first-installation run: npm ci continue-on-error: true - - if: steps.first-installation.outputs.status == 'failure' && steps.packagejson.outputs.exists == 'true' + - if: steps.first-installation.outcome != 'success' && steps.packagejson.outputs.exists == 'true' name: Clear NPM cache and install deps again run: | npm cache clean --force From f334d433a2f89c656a7c33b6ad034425e7cfee18 Mon Sep 17 00:00:00 2001 From: Bishal <153212508+ibishal@users.noreply.github.com> Date: Thu, 4 Apr 2024 19:38:59 +0530 Subject: [PATCH 11/18] ci: fix the escape character typo in `/ptal` command (#284) --- .github/workflows/help-command.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index ada81682..55353bb8 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -31,7 +31,7 @@ jobs: At the moment the following comments are supported in pull requests: - - \`/please-take-a-look` or \`/ptal\` - This comment will add a comment to the PR asking for attention from the reviewrs who have not reviewed the PR yet. + - \`/please-take-a-look\` or \`/ptal\` - This comment will add a comment to the PR asking for attention from the reviewrs who have not reviewed the PR yet. - \`/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 or it is a draft PR.` From 69f31a8789ac3cb9ae573d7c0f2bea06197f53f2 Mon Sep 17 00:00:00 2001 From: Bishal <153212508+ibishal@users.noreply.github.com> Date: Thu, 4 Apr 2024 19:41:56 +0530 Subject: [PATCH 12/18] ci: add a filter to check if reviewer is bot or not in `/ptal` command (#285) Co-authored-by: Lukasz Gornicki --- .github/workflows/please-take-a-look-command.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/please-take-a-look-command.yml b/.github/workflows/please-take-a-look-command.yml index 216055ca..b26cbc41 100644 --- a/.github/workflows/please-take-a-look-command.yml +++ b/.github/workflows/please-take-a-look-command.yml @@ -2,8 +2,8 @@ # 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 uses Github actions to listen for comments on issues and pull requests and -# if the comment contains /ping-for-attention or /pfa it will add a comment pinging -# the code-owners who have not yet reviewed the pull request +# if the comment contains /please-take-a-look or /ptal it will add a comment pinging +# the code-owners who are reviewers for PR name: Please take a Look @@ -44,7 +44,7 @@ jobs: const reviewersWhoHaveNotReviewed = reviewers.filter(reviewer => !reviewersWhoHaveReviewed.includes(reviewer)); if (reviewersWhoHaveNotReviewed.length > 0) { - const comment = reviewersWhoHaveNotReviewed.map(reviewer => `@${reviewer}`).join(' '); + const comment = reviewersWhoHaveNotReviewed.filter(reviewer => reviewer !== 'asyncapi-bot-eve' ).map(reviewer => `@${reviewer}`).join(' '); await github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, From 6f736ec2a4d8e3d364392b08cd5388d032bd1af7 Mon Sep 17 00:00:00 2001 From: Lukasz Gornicki Date: Tue, 9 Apr 2024 18:10:39 +0200 Subject: [PATCH 13/18] ci: improve node testing and release (#287) --- .github/workflows/if-nodejs-pr-testing.yml | 24 ++++++++--------- .github/workflows/if-nodejs-release.yml | 31 ++++++++++------------ 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index 73a2af5c..66ea6552 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -39,9 +39,10 @@ jobs: run: | git config --global core.autocrlf false git config --global core.eol lf + shell: bash - if: steps.should_run.outputs.shouldrun == 'true' name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - if: steps.should_run.outputs.shouldrun == 'true' name: Check if Node.js project and has package.json id: packagejson @@ -53,27 +54,26 @@ jobs: id: lockversion - if: steps.packagejson.outputs.exists == 'true' name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "${{ steps.lockversion.outputs.version }}" - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + - if: steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest' + #npm cli 10 is buggy because of some cache issue + name: Install npm cli 8 + shell: bash + run: npm install -g npm@8.19.4 - if: steps.packagejson.outputs.exists == 'true' name: Install dependencies - id: first-installation + shell: bash run: npm ci - continue-on-error: true - - if: steps.first-installation.outcome != 'success' && steps.packagejson.outputs.exists == 'true' - name: Clear NPM cache and install deps again - run: | - npm cache clean --force - npm ci - if: steps.packagejson.outputs.exists == 'true' name: Test run: npm test --if-present - - if: steps.packagejson.outputs.exists == 'true' + - if: steps.packagejson.outputs.exists == 'true' && matrix.os == 'ubuntu-latest' + #linting should run just one and not on all possible operating systems name: Run linter run: npm run lint --if-present - if: steps.packagejson.outputs.exists == 'true' name: Run release assets generation to make sure PR does not break it + shell: bash run: npm run generate:assets --if-present diff --git a/.github/workflows/if-nodejs-release.yml b/.github/workflows/if-nodejs-release.yml index f407e59a..234c5a9c 100644 --- a/.github/workflows/if-nodejs-release.yml +++ b/.github/workflows/if-nodejs-release.yml @@ -38,8 +38,9 @@ jobs: run: | git config --global core.autocrlf false git config --global core.eol lf + shell: bash - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check if Node.js project and has package.json id: packagejson run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT @@ -50,14 +51,18 @@ jobs: id: lockversion - if: steps.packagejson.outputs.exists == 'true' name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "${{ steps.lockversion.outputs.version }}" - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + - if: steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest' + name: Install npm cli 8 + shell: bash + #npm cli 10 is buggy because of some cache issues + run: npm install -g npm@8.19.4 - if: steps.packagejson.outputs.exists == 'true' name: Install dependencies - run: npm install + shell: bash + run: npm ci - if: steps.packagejson.outputs.exists == 'true' name: Run test run: npm test --if-present @@ -81,7 +86,7 @@ jobs: git config --global core.autocrlf false git config --global core.eol lf - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check if Node.js project and has package.json id: packagejson run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT @@ -92,21 +97,13 @@ jobs: id: lockversion - if: steps.packagejson.outputs.exists == 'true' name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "${{ steps.lockversion.outputs.version }}" - cache: 'npm' - cache-dependency-path: '**/package-lock.json' - if: steps.packagejson.outputs.exists == 'true' name: Install dependencies - id: first-installation + shell: bash run: npm ci - continue-on-error: true - - if: steps.first-installation.outcome != 'success' && steps.packagejson.outputs.exists == 'true' - name: Clear NPM cache and install deps again - run: | - npm cache clean --force - npm ci - if: steps.packagejson.outputs.exists == 'true' name: Add plugin for conventional commits for semantic-release run: npm install --save-dev conventional-changelog-conventionalcommits@5.0.0 @@ -131,4 +128,4 @@ jobs: fields: repo,action,workflow text: 'Release workflow failed in release job' env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} \ No newline at end of file From ac7b58a83d945996b7243dc19c0f49d493547b43 Mon Sep 17 00:00:00 2001 From: Lukasz Gornicki Date: Tue, 9 Apr 2024 18:23:42 +0200 Subject: [PATCH 14/18] ci: use latest bumping action feature to reuse PRs (#288) Co-authored-by: Khuda Dad Nomani <32505158+KhudaDad414@users.noreply.github.com> --- .github/workflows/bump.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index dff50cfa..1e17ccf2 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -26,9 +26,10 @@ jobs: run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT - if: steps.packagejson.outputs.exists == 'true' name: Bumping latest version of this package in other repositories - uses: derberg/npm-dependency-manager-for-your-github-org@3df56be95bcaa5c76a9c9a4af863ab151545b649 # using v6.-.- https://github.com/derberg/npm-dependency-manager-for-your-github-org/releases/tag/v6 + uses: derberg/npm-dependency-manager-for-your-github-org@1eafd3bf3974f21d395c1abac855cb04b295d570 # using v6.-.- https://github.com/derberg/npm-dependency-manager-for-your-github-org/releases/tag/v6 with: github_token: ${{ secrets.GH_TOKEN }} committer_username: asyncapi-bot committer_email: info@asyncapi.io repos_to_ignore: spec,bindings,saunter + custom_id: "dependency update from asyncapi bot" From 9b309c0c57107cc0df37a0cbe003d4bd6ab805f2 Mon Sep 17 00:00:00 2001 From: Ashish Padhy <100484401+Shurtu-gal@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:16:01 +0530 Subject: [PATCH 15/18] ci: add update pr workflow (#262) Co-authored-by: Lukasz Gornicki --- ...d-ready-to-merge-or-do-not-merge-label.yml | 4 +- .github/workflows/autoupdate.yml | 68 ++++++------ .github/workflows/global-replicator.yml | 2 +- .github/workflows/help-command.yml | 3 +- .github/workflows/update-pr.yml | 102 ++++++++++++++++++ 5 files changed, 142 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/update-pr.yml 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 66606fc1..02d71a79 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 @@ -59,7 +59,9 @@ jobs: 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. + PRO-TIP: To request an update from the upstream branch, simply comment \`/u\` or \`/update\` and our bot will handle the update operation promptly. + + 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. Also the update will not work if your fork is located in an organization, not under your personal profile. Thanks 😄` }) } diff --git a/.github/workflows/autoupdate.yml b/.github/workflows/autoupdate.yml index ad8e0198..eeb77a47 100644 --- a/.github/workflows/autoupdate.yml +++ b/.github/workflows/autoupdate.yml @@ -1,34 +1,34 @@ -# 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: -# - 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 - -name: autoupdate - -on: - push: - branches-ignore: - - 'version-bump/**' - - 'dependabot/**' - - 'bot/**' - - 'all-contributors/**' - -jobs: - autoupdate-for-bot: - if: startsWith(github.repository, 'asyncapi/') - 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_BOT_EVE }}' - PR_FILTER: "labelled" - PR_LABELS: "autoupdate" - PR_READY_STATE: "ready_for_review" - MERGE_CONFLICT_ACTION: "ignore" +# 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: +# - 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 + +name: autoupdate + +on: + push: + branches-ignore: + - 'version-bump/**' + - 'dependabot/**' + - 'bot/**' + - 'all-contributors/**' + +jobs: + autoupdate-for-bot: + if: startsWith(github.repository, 'asyncapi/') + 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_BOT_EVE }}' + PR_FILTER: "labelled" + PR_LABELS: "autoupdate" + PR_READY_STATE: "ready_for_review" + MERGE_CONFLICT_ACTION: "ignore" diff --git a/.github/workflows/global-replicator.yml b/.github/workflows/global-replicator.yml index 2e66ff04..66d6e449 100644 --- a/.github/workflows/global-replicator.yml +++ b/.github/workflows/global-replicator.yml @@ -138,7 +138,7 @@ jobs: uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 with: github_token: ${{ secrets.GH_TOKEN }} - patterns_to_include: .github/workflows/scripts,.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml,.github/workflows/add-good-first-issue-labels.yml,.github/workflows/automerge-for-humans-merging.yml,.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml,.github/workflows/automerge-orphans.yml,.github/workflows/automerge.yml,.github/workflows/autoupdate.yml,.github/workflows/help-command.yml,.github/workflows/issues-prs-notifications.yml,.github/workflows/lint-pr-title.yml,.github/workflows/notify-tsc-members-mention.yml,.github/workflows/stale-issues-prs.yml,.github/workflows/welcome-first-time-contrib.yml,.github/workflows/release-announcements.yml,.github/workflows/bounty-program-commands.yml,.github/workflows/please-take-a-look-command.yml + patterns_to_include: .github/workflows/scripts,.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml,.github/workflows/add-good-first-issue-labels.yml,.github/workflows/automerge-for-humans-merging.yml,.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml,.github/workflows/automerge-orphans.yml,.github/workflows/automerge.yml,.github/workflows/autoupdate.yml,.github/workflows/help-command.yml,.github/workflows/issues-prs-notifications.yml,.github/workflows/lint-pr-title.yml,.github/workflows/notify-tsc-members-mention.yml,.github/workflows/stale-issues-prs.yml,.github/workflows/welcome-first-time-contrib.yml,.github/workflows/release-announcements.yml,.github/workflows/bounty-program-commands.yml,.github/workflows/please-take-a-look-command.yml,.github/workflows/update-pr.yml committer_username: asyncapi-bot committer_email: info@asyncapi.io commit_message: "ci: update of files from global .github repo" diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index 55353bb8..3f4dcbc4 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -34,7 +34,8 @@ jobs: - \`/please-take-a-look\` or \`/ptal\` - This comment will add a comment to the PR asking for attention from the reviewrs who have not reviewed the PR yet. - \`/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 or it is a draft PR.` + - \`/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 or it is a draft PR. (Currently only works for upstream branches.) + - \`/update\` or \`/u\` - This comment will update the PR with the latest changes from the target branch. Unless there is a merge conflict or it is a draft PR. NOTE: this only updates the PR once, so if you need to update again, you need to call the command again.` }) create_help_comment_issue: diff --git a/.github/workflows/update-pr.yml b/.github/workflows/update-pr.yml new file mode 100644 index 00000000..2fa19b0a --- /dev/null +++ b/.github/workflows/update-pr.yml @@ -0,0 +1,102 @@ +# 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 will run on every comment with /update or /u. And will create merge-commits for the PR. +# This also works with forks, not only with branches in the same repository/organization. +# Currently, does not work with forks in different organizations. + +# This workflow will be distributed to all repositories in the AsyncAPI organization + +name: Update PR branches from fork + +on: + issue_comment: + types: [created] + +jobs: + update-pr: + if: > + startsWith(github.repository, 'asyncapi/') && + github.event.issue.pull_request && + github.event.issue.state != 'closed' && ( + contains(github.event.comment.body, '/update') || + contains(github.event.comment.body, '/u') + ) + runs-on: ubuntu-latest + steps: + - name: Get Pull Request Details + id: pr + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} + previews: 'merge-info-preview' # https://docs.github.com/en/graphql/overview/schema-previews#merge-info-preview-more-detailed-information-about-a-pull-requests-merge-state-preview + script: | + const prNumber = context.payload.issue.number; + core.debug(`PR Number: ${prNumber}`); + const { data: pr } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber + }); + + // If the PR has conflicts, we don't want to update it + const updateable = ['behind', 'blocked', 'unknown', 'draft', 'clean'].includes(pr.mergeable_state); + console.log(`PR #${prNumber} is ${pr.mergeable_state} and is ${updateable ? 'updateable' : 'not updateable'}`); + core.setOutput('updateable', updateable); + + core.debug(`Updating PR #${prNumber} with head ${pr.head.sha}`); + + return { + id: pr.node_id, + number: prNumber, + head: pr.head.sha, + } + - name: Update the Pull Request + if: steps.pr.outputs.updateable == 'true' + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const mutation = `mutation update($input: UpdatePullRequestBranchInput!) { + updatePullRequestBranch(input: $input) { + pullRequest { + mergeable + } + } + }`; + + const pr_details = ${{ steps.pr.outputs.result }}; + + try { + const { data } = await github.graphql(mutation, { + input: { + pullRequestId: pr_details.id, + expectedHeadOid: pr_details.head, + } + }); + } catch (GraphQLError) { + core.debug(GraphQLError); + if ( + GraphQLError.name === 'GraphqlResponseError' && + GraphQLError.errors.some( + error => error.type === 'FORBIDDEN' || error.type === 'UNAUTHORIZED' + ) + ) { + // Add comment to PR if the bot doesn't have permissions to update the PR + const comment = `Hi @${context.actor}. Update of PR has failed. It can be due to one of the following reasons: + - I don't have permissions to update this PR. To update your fork with upstream using bot you need 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 the PR. + - The fork is located in an organization, not under your personal profile. No solution for that. You are on your own with manual update. + - There may be a conflict in the PR. Please resolve the conflict and try again.`; + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: comment + }); + + core.setFailed('Bot does not have permissions to update the PR'); + } else { + core.setFailed(GraphQLError.message); + } + } From a47f8ac321ff0fc90ad05a901ae54e725b191e0a Mon Sep 17 00:00:00 2001 From: Sergio Moya <1083296+smoya@users.noreply.github.com> Date: Thu, 18 Apr 2024 12:52:57 +0200 Subject: [PATCH 16/18] ci: ignore server-api repo in bump workflow (#291) --- .github/workflows/bump.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index 1e17ccf2..43ba75fd 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -31,5 +31,5 @@ jobs: github_token: ${{ secrets.GH_TOKEN }} committer_username: asyncapi-bot committer_email: info@asyncapi.io - repos_to_ignore: spec,bindings,saunter + repos_to_ignore: spec,bindings,saunter,server-api custom_id: "dependency update from asyncapi bot" From e6b0dd93c31424e4147b24971d7e1c9727b6999b Mon Sep 17 00:00:00 2001 From: Jonas Lagoni Date: Tue, 30 Apr 2024 11:05:22 +0200 Subject: [PATCH 17/18] ci: add support for `next` release branch (#294) --- .github/workflows/.releaserc | 2 ++ .github/workflows/if-nodejs-release.yml | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/.releaserc b/.github/workflows/.releaserc index bc27e350..1ac05cb1 100644 --- a/.github/workflows/.releaserc +++ b/.github/workflows/.releaserc @@ -13,6 +13,8 @@ branches: prerelease: true - name: alpha prerelease: true +- name: next + prerelease: true plugins: - - "@semantic-release/commit-analyzer" - preset: conventionalcommits diff --git a/.github/workflows/if-nodejs-release.yml b/.github/workflows/if-nodejs-release.yml index 234c5a9c..e578d900 100644 --- a/.github/workflows/if-nodejs-release.yml +++ b/.github/workflows/if-nodejs-release.yml @@ -15,6 +15,7 @@ on: - next-major-spec - beta - alpha + - next jobs: @@ -128,4 +129,4 @@ jobs: fields: repo,action,workflow text: 'Release workflow failed in release job' env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} \ No newline at end of file + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} From d0b2e01c78a03d0803d09bd6fa0a0e0bc0225923 Mon Sep 17 00:00:00 2001 From: Viacheslav Turovskyi Date: Mon, 6 May 2024 09:48:50 +0300 Subject: [PATCH 18/18] ci: add Bounty Program command `/unbounty` (#295) --- .github/workflows/bounty-program-commands.yml | 50 ++++++++++++++++--- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bounty-program-commands.yml b/.github/workflows/bounty-program-commands.yml index 433f7d95..645e0c90 100644 --- a/.github/workflows/bounty-program-commands.yml +++ b/.github/workflows/bounty-program-commands.yml @@ -14,12 +14,18 @@ on: types: - created +env: + BOUNTY_PROGRAM_LABELS_JSON: | + [ + {"name": "bounty", "color": "0e8a16", "description": "Participation in the Bounty Program"} + ] + jobs: guard-against-unauthorized-use: if: > github.actor != ('aeworxet' || 'thulieblack') && ( - contains(github.event.comment.body, '/bounty' ) + startsWith(github.event.comment.body, '/bounty' ) ) runs-on: ubuntu-latest @@ -46,15 +52,10 @@ jobs: if: > github.actor == ('aeworxet' || 'thulieblack') && ( - contains(github.event.comment.body, '/bounty' ) + startsWith(github.event.comment.body, '/bounty' ) ) runs-on: ubuntu-latest - env: - BOUNTY_PROGRAM_LABELS_JSON: | - [ - {"name": "bounty", "color": "0e8a16", "description": "Participation in the Bounty Program"} - ] steps: - name: Add label `bounty` @@ -88,3 +89,38 @@ jobs: repo: context.repo.repo, labels: [BOUNTY_PROGRAM_LABELS[0].name] }) + + remove-label-bounty: + if: > + github.actor == ('aeworxet' || 'thulieblack') && + ( + startsWith(github.event.comment.body, '/unbounty' ) + ) + + runs-on: ubuntu-latest + + steps: + - name: Remove label `bounty` + uses: actions/github-script@v6 + + with: + github-token: ${{ secrets.GH_TOKEN }} + script: | + const BOUNTY_PROGRAM_LABELS = JSON.parse(process.env.BOUNTY_PROGRAM_LABELS_JSON); + let LIST_OF_LABELS_FOR_ISSUE = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + + LIST_OF_LABELS_FOR_ISSUE = LIST_OF_LABELS_FOR_ISSUE.data.map(key => key.name); + + if (LIST_OF_LABELS_FOR_ISSUE.includes(BOUNTY_PROGRAM_LABELS[0].name)) { + console.log('Removing label `bounty`...'); + github.rest.issues.removeLabel({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + name: [BOUNTY_PROGRAM_LABELS[0].name] + }) + }