From 76fd8e42d2ac81c9f29245aad527569925daeafd Mon Sep 17 00:00:00 2001 From: Sambhav Gupta Date: Mon, 9 Dec 2024 22:36:29 +0530 Subject: [PATCH 01/11] fix: fixed the notify triager workflow --- .github/workflows/notify-triager.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/notify-triager.yml b/.github/workflows/notify-triager.yml index bcdd6ef3d352..58ee7dae3bc8 100644 --- a/.github/workflows/notify-triager.yml +++ b/.github/workflows/notify-triager.yml @@ -17,7 +17,10 @@ jobs: - name: Get commit message id: commit-message run: | + # Extract the commit message commit_message=$(git log --format=%B -n 1 ${{ github.event.pull_request.head.sha }}) + commit_message=$(echo "$commit_message" | tr '\n' ' ') + commit_message=$(echo "$commit_message" | sed 's/[<>|]//g' | sed 's/[][]//g' | sed 's/(//g' | sed 's/)//g' | xargs) echo "commit_message=$commit_message" >> $GITHUB_OUTPUT - name: Check if last commit is a merge commit @@ -34,19 +37,17 @@ jobs: - name: Checkout asyncapi/website Repository uses: actions/checkout@v4.1.1 + - name: Get all changed files + id: changed-files + uses: tj-actions/changed-files@v45 + - name: Check PR Changes for .md files id: md-pr-changes - uses: tj-actions/changed-files@aa08304bd477b800d468db44fe10f6c61f7f7b11 # version 42.1.0 https://github.com/tj-actions/changed-files/releases/tag/v42.1.0 + uses: tj-actions/changed-files@v45 # version 42.1.0 https://github.com/tj-actions/changed-files/releases/tag/v42.1.0 with: files: | **.md - - - name: Check PR Changes for non-.md files - id: non-md-pr-changes - uses: tj-actions/changed-files@aa08304bd477b800d468db44fe10f6c61f7f7b11 # version 42.1.0 https://github.com/tj-actions/changed-files/releases/tag/v42.1.0 - with: - files: | - !**.md + - name: Extract Doc Triage Maintainers @@ -68,7 +69,7 @@ jobs: echo "codeTriagers=$codeTriagers" >> $GITHUB_ENV - name: Add Reviewers for code files - if: steps.check-merge-branch.outputs.isMergeCommit == 'false' && steps.non-md-pr-changes.outputs.any_changed == 'true' + if: ${{ steps.check-merge-branch.outputs.isMergeCommit == 'false' && steps.changed-files.outputs.all_changed_files_count != steps.md-pr-changes.outputs.all_changed_files_count }} run: | IFS=' ' read -r -a codeTriagers <<< "${{ env.codeTriagers }}" reviewers=$(printf ', "%s"' "${codeTriagers[@]}") @@ -83,7 +84,7 @@ jobs: }" - name: Add Reviewers for doc files - if: steps.check-merge-branch.outputs.isMergeCommit == 'false' && steps.md-pr-changes.outputs.any_changed == 'true' + if: ${{ steps.check-merge-branch.outputs.isMergeCommit == 'false' && steps.md-pr-changes.outputs.any_changed == 'true' }} run: | IFS=' ' read -r -a docTriagers <<< "${{ env.docTriagers }}" reviewers=$(printf ', "%s"' "${docTriagers[@]}") @@ -96,3 +97,4 @@ jobs: -d "{ \"reviewers\": $reviewers }" + \ No newline at end of file From 02b18ed440ff04547266899ba141e658fc7f46e4 Mon Sep 17 00:00:00 2001 From: Sambhav Gupta <81870866+sambhavgupta0705@users.noreply.github.com> Date: Mon, 9 Dec 2024 23:13:50 +0530 Subject: [PATCH 02/11] Update notify-triager.yml --- .github/workflows/notify-triager.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/notify-triager.yml b/.github/workflows/notify-triager.yml index 58ee7dae3bc8..6a7ae1146599 100644 --- a/.github/workflows/notify-triager.yml +++ b/.github/workflows/notify-triager.yml @@ -39,11 +39,11 @@ jobs: - name: Get all changed files id: changed-files - uses: tj-actions/changed-files@v45 + uses: tj-actions/changed-files@aa08304bd477b800d468db44fe10f6c61f7f7b11 - name: Check PR Changes for .md files id: md-pr-changes - uses: tj-actions/changed-files@v45 # version 42.1.0 https://github.com/tj-actions/changed-files/releases/tag/v42.1.0 + uses: tj-actions/changed-files@aa08304bd477b800d468db44fe10f6c61f7f7b11 # version 42.1.0 https://github.com/tj-actions/changed-files/releases/tag/v42.1.0 with: files: | **.md @@ -97,4 +97,4 @@ jobs: -d "{ \"reviewers\": $reviewers }" - \ No newline at end of file + From 9b5d530fc39f611048b5705db945ad4293348178 Mon Sep 17 00:00:00 2001 From: Sambhav Gupta Date: Mon, 16 Dec 2024 12:53:34 +0530 Subject: [PATCH 03/11] fix: using git diff --- .github/workflows/notify-triager.yml | 39 ++++++++++++++++------------ 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/notify-triager.yml b/.github/workflows/notify-triager.yml index 58ee7dae3bc8..1ad00ed5d0c5 100644 --- a/.github/workflows/notify-triager.yml +++ b/.github/workflows/notify-triager.yml @@ -1,7 +1,7 @@ name: Notify Triagers on: - pull_request_target: + pull_request: types: [opened, reopened, synchronize, edited, ready_for_review] jobs: @@ -11,8 +11,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4.1.1 with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 - name: Get commit message id: commit-message @@ -34,21 +33,27 @@ jobs: echo "isMergeCommit=false" >> $GITHUB_OUTPUT fi - - name: Checkout asyncapi/website Repository - uses: actions/checkout@v4.1.1 + - name: Count changed files + id: changed_files + run: | + # Get the list of files changed in the latest commit + changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}) - - name: Get all changed files - id: changed-files - uses: tj-actions/changed-files@v45 + # Initialize counters + md_count=0 + non_md_count=0 - - name: Check PR Changes for .md files - id: md-pr-changes - uses: tj-actions/changed-files@v45 # version 42.1.0 https://github.com/tj-actions/changed-files/releases/tag/v42.1.0 - with: - files: | - **.md - + # Loop through the changed files to count .md and non-.md files + for file in $changed_files; do + if [[ $file == *.md ]]; then + md_count=$((md_count + 1)) + else + non_md_count=$((non_md_count + 1)) + fi + done + echo "md_count=$md_count" >> $GITHUB_OUTPUT + echo "non_md_count=$non_md_count" >> $GITHUB_OUTPUT - name: Extract Doc Triage Maintainers id: doc-triager @@ -69,7 +74,7 @@ jobs: echo "codeTriagers=$codeTriagers" >> $GITHUB_ENV - name: Add Reviewers for code files - if: ${{ steps.check-merge-branch.outputs.isMergeCommit == 'false' && steps.changed-files.outputs.all_changed_files_count != steps.md-pr-changes.outputs.all_changed_files_count }} + if: ${{ steps.check-merge-branch.outputs.isMergeCommit == 'false' && steps.changed_files.outputs.non_md_count > 0 }} run: | IFS=' ' read -r -a codeTriagers <<< "${{ env.codeTriagers }}" reviewers=$(printf ', "%s"' "${codeTriagers[@]}") @@ -84,7 +89,7 @@ jobs: }" - name: Add Reviewers for doc files - if: ${{ steps.check-merge-branch.outputs.isMergeCommit == 'false' && steps.md-pr-changes.outputs.any_changed == 'true' }} + if: ${{ steps.check-merge-branch.outputs.isMergeCommit == 'false' && steps.changed_files.outputs.md_count > 0 }} run: | IFS=' ' read -r -a docTriagers <<< "${{ env.docTriagers }}" reviewers=$(printf ', "%s"' "${docTriagers[@]}") From 0a69e1a279718cce5a21ceeb544733a08f88fcea Mon Sep 17 00:00:00 2001 From: Sambhav Gupta Date: Mon, 16 Dec 2024 12:57:23 +0530 Subject: [PATCH 04/11] triggering the workflow --- .github/workflows/notify-triager.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/notify-triager.yml b/.github/workflows/notify-triager.yml index 8b2e861db24c..f041ff8f8787 100644 --- a/.github/workflows/notify-triager.yml +++ b/.github/workflows/notify-triager.yml @@ -39,7 +39,6 @@ jobs: # Get the list of files changed in the latest commit changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}) -<<<<<<< HEAD # Initialize counters md_count=0 non_md_count=0 @@ -52,19 +51,6 @@ jobs: non_md_count=$((non_md_count + 1)) fi done -======= - - name: Get all changed files - id: changed-files - uses: tj-actions/changed-files@aa08304bd477b800d468db44fe10f6c61f7f7b11 - - - name: Check PR Changes for .md files - id: md-pr-changes - uses: tj-actions/changed-files@aa08304bd477b800d468db44fe10f6c61f7f7b11 # version 42.1.0 https://github.com/tj-actions/changed-files/releases/tag/v42.1.0 - with: - files: | - **.md - ->>>>>>> b0e41ec2418d698e40ee2ef929dd7ccdc0a32227 echo "md_count=$md_count" >> $GITHUB_OUTPUT echo "non_md_count=$non_md_count" >> $GITHUB_OUTPUT From 2794fca10b0fec9b348e687e46f1df17d6321bad Mon Sep 17 00:00:00 2001 From: Sambhav Gupta Date: Mon, 16 Dec 2024 13:00:04 +0530 Subject: [PATCH 05/11] trigger doc triagers --- markdown/docs/guides/validate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdown/docs/guides/validate.md b/markdown/docs/guides/validate.md index a17ccf35bf7f..54eb2956c3d2 100644 --- a/markdown/docs/guides/validate.md +++ b/markdown/docs/guides/validate.md @@ -13,7 +13,7 @@ Validating an AsyncAPI document can mean one of two things: - Validation against the best practices or company governance rules also known as linting. ### Validate against specification -Validating against the specification ensures that every content of the document is written in accordance with the AsyncAPI specification. Several tool options exist for validating against the specification: _AsyncAPI Studio_, _AsyncAPI CLI_, and _Parsers_. +Validating against the specification ensures that every content of the document is written in accordance with the AsyncAPI specification. Several tool options exist for validating against the specificaton: _AsyncAPI Studio_, _AsyncAPI CLI_, and _Parsers_. #### AsyncAPI Studio validation [AsyncAPI Studio](https://studio.asyncapi.com/) provides a visual and easy way to validate your AsyncAPI documents against the specification. (It uses the [AsyncAPI JavaScript parser](https://github.com/asyncapi/parser-js) behind the scenes to perform syntax checks and validate documents.) From 4a20c2150900d7932dfbefc1ddb5dbc27f7d0e7b Mon Sep 17 00:00:00 2001 From: Sambhav Gupta Date: Mon, 16 Dec 2024 13:01:42 +0530 Subject: [PATCH 06/11] revert --- markdown/docs/guides/validate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdown/docs/guides/validate.md b/markdown/docs/guides/validate.md index 54eb2956c3d2..a17ccf35bf7f 100644 --- a/markdown/docs/guides/validate.md +++ b/markdown/docs/guides/validate.md @@ -13,7 +13,7 @@ Validating an AsyncAPI document can mean one of two things: - Validation against the best practices or company governance rules also known as linting. ### Validate against specification -Validating against the specification ensures that every content of the document is written in accordance with the AsyncAPI specification. Several tool options exist for validating against the specificaton: _AsyncAPI Studio_, _AsyncAPI CLI_, and _Parsers_. +Validating against the specification ensures that every content of the document is written in accordance with the AsyncAPI specification. Several tool options exist for validating against the specification: _AsyncAPI Studio_, _AsyncAPI CLI_, and _Parsers_. #### AsyncAPI Studio validation [AsyncAPI Studio](https://studio.asyncapi.com/) provides a visual and easy way to validate your AsyncAPI documents against the specification. (It uses the [AsyncAPI JavaScript parser](https://github.com/asyncapi/parser-js) behind the scenes to perform syntax checks and validate documents.) From 4fb13cc7fef136082201728fec242df607f9bc57 Mon Sep 17 00:00:00 2001 From: Sambhav Gupta Date: Mon, 16 Dec 2024 13:23:32 +0530 Subject: [PATCH 07/11] fix --- .github/workflows/notify-triager.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/notify-triager.yml b/.github/workflows/notify-triager.yml index f041ff8f8787..4fb2b48c27c2 100644 --- a/.github/workflows/notify-triager.yml +++ b/.github/workflows/notify-triager.yml @@ -1,7 +1,7 @@ name: Notify Triagers on: - pull_request: + pull_request_target: types: [opened, reopened, synchronize, edited, ready_for_review] jobs: From 6d5703d268ff435df845eb1f01187982d6d7ec67 Mon Sep 17 00:00:00 2001 From: Sambhav Gupta Date: Mon, 16 Dec 2024 13:24:39 +0530 Subject: [PATCH 08/11] trigger doc reviewers --- markdown/docs/guides/validate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdown/docs/guides/validate.md b/markdown/docs/guides/validate.md index a17ccf35bf7f..7fda9c40b5d5 100644 --- a/markdown/docs/guides/validate.md +++ b/markdown/docs/guides/validate.md @@ -13,7 +13,7 @@ Validating an AsyncAPI document can mean one of two things: - Validation against the best practices or company governance rules also known as linting. ### Validate against specification -Validating against the specification ensures that every content of the document is written in accordance with the AsyncAPI specification. Several tool options exist for validating against the specification: _AsyncAPI Studio_, _AsyncAPI CLI_, and _Parsers_. +Validating against the specification enures that every content of the document is written in accordance with the AsyncAPI specification. Several tool options exist for validating against the specification: _AsyncAPI Studio_, _AsyncAPI CLI_, and _Parsers_. #### AsyncAPI Studio validation [AsyncAPI Studio](https://studio.asyncapi.com/) provides a visual and easy way to validate your AsyncAPI documents against the specification. (It uses the [AsyncAPI JavaScript parser](https://github.com/asyncapi/parser-js) behind the scenes to perform syntax checks and validate documents.) From 67d390c9e83c8940f02f77bbdcb7a42408b82a23 Mon Sep 17 00:00:00 2001 From: Sambhav Gupta Date: Mon, 16 Dec 2024 13:26:28 +0530 Subject: [PATCH 09/11] revert --- markdown/docs/guides/validate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdown/docs/guides/validate.md b/markdown/docs/guides/validate.md index 7fda9c40b5d5..a17ccf35bf7f 100644 --- a/markdown/docs/guides/validate.md +++ b/markdown/docs/guides/validate.md @@ -13,7 +13,7 @@ Validating an AsyncAPI document can mean one of two things: - Validation against the best practices or company governance rules also known as linting. ### Validate against specification -Validating against the specification enures that every content of the document is written in accordance with the AsyncAPI specification. Several tool options exist for validating against the specification: _AsyncAPI Studio_, _AsyncAPI CLI_, and _Parsers_. +Validating against the specification ensures that every content of the document is written in accordance with the AsyncAPI specification. Several tool options exist for validating against the specification: _AsyncAPI Studio_, _AsyncAPI CLI_, and _Parsers_. #### AsyncAPI Studio validation [AsyncAPI Studio](https://studio.asyncapi.com/) provides a visual and easy way to validate your AsyncAPI documents against the specification. (It uses the [AsyncAPI JavaScript parser](https://github.com/asyncapi/parser-js) behind the scenes to perform syntax checks and validate documents.) From 7d491bfa6f1b6a52eeb33899386ffc5ef99fc636 Mon Sep 17 00:00:00 2001 From: Sambhav Gupta Date: Mon, 16 Dec 2024 13:32:06 +0530 Subject: [PATCH 10/11] fix --- .github/workflows/notify-triager.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/notify-triager.yml b/.github/workflows/notify-triager.yml index 4fb2b48c27c2..e50a18a8f06c 100644 --- a/.github/workflows/notify-triager.yml +++ b/.github/workflows/notify-triager.yml @@ -11,7 +11,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4.1.1 with: - fetch-depth: 0 + fetch-depth: 2 - name: Get commit message id: commit-message @@ -43,14 +43,10 @@ jobs: md_count=0 non_md_count=0 - # Loop through the changed files to count .md and non-.md files - for file in $changed_files; do - if [[ $file == *.md ]]; then - md_count=$((md_count + 1)) - else - non_md_count=$((non_md_count + 1)) - fi - done + # Count .md files + md_count=$(echo "$changed_files" | grep -c '\.md$' || true) + # Count non-.md files + non_md_count=$(echo "$changed_files" | grep -vc '\.md$' || true) echo "md_count=$md_count" >> $GITHUB_OUTPUT echo "non_md_count=$non_md_count" >> $GITHUB_OUTPUT From 852987c1affeadf6c9299b571771fcd3d32669d1 Mon Sep 17 00:00:00 2001 From: Sambhav Gupta <81870866+sambhavgupta0705@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:45:30 +0530 Subject: [PATCH 11/11] Update notify-triager.yml --- .github/workflows/notify-triager.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/notify-triager.yml b/.github/workflows/notify-triager.yml index e50a18a8f06c..609f6424ca03 100644 --- a/.github/workflows/notify-triager.yml +++ b/.github/workflows/notify-triager.yml @@ -11,7 +11,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4.1.1 with: - fetch-depth: 2 + fetch-depth: 0 - name: Get commit message id: commit-message