Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed the notify triager workflow #3460

Merged
merged 17 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 25 additions & 18 deletions .github/workflows/notify-triager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ jobs:
- name: Checkout Repository
uses: actions/[email protected]
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
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)
anshgoyalevil marked this conversation as resolved.
Show resolved Hide resolved
echo "commit_message=$commit_message" >> $GITHUB_OUTPUT

- name: Check if last commit is a merge commit
Expand All @@ -31,23 +33,27 @@ jobs:
echo "isMergeCommit=false" >> $GITHUB_OUTPUT
fi

- name: Checkout asyncapi/website Repository
uses: actions/[email protected]
- 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: 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
# Initialize counters
md_count=0
non_md_count=0

- 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
# 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
anshgoyalevil marked this conversation as resolved.
Show resolved Hide resolved

- name: Extract Doc Triage Maintainers
id: doc-triager
Expand All @@ -68,7 +74,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.non_md_count > 0 }}
run: |
IFS=' ' read -r -a codeTriagers <<< "${{ env.codeTriagers }}"
reviewers=$(printf ', "%s"' "${codeTriagers[@]}")
Expand All @@ -83,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[@]}")
Expand All @@ -96,3 +102,4 @@ jobs:
-d "{
\"reviewers\": $reviewers
}"

2 changes: 1 addition & 1 deletion markdown/docs/guides/validate.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down
Loading