Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
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
34 changes: 34 additions & 0 deletions .github/workflows/pr-desc-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) 2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# A workflow to check if comment exists in PR description
name: pr description check

on:
pull_request:
types: [opened, edited, reopened]

jobs:
pr-description-check:
runs-on: ubuntu-latest
permissions:
pull-requests: read
statuses: write
contents: read
if: "!contains(github.event.pull_request.title, '[bot]')"
steps:
- name: pr-description-check
uses: NVIDIA/spark-rapids-common/pr-description-check@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
53 changes: 53 additions & 0 deletions pr-description-check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright (c) 2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'PR Description Check'
description: 'check if comment exists in PR description'
inputs:
github-token:
description: "github token"
required: true
type: string

runs:
using: "composite"
steps:
- name: Get PR description
id: pr_description
uses: actions/github-script@v7
with:
github-token: ${{ inputs.github-token }}
script: |
const pr = context.payload.pull_request;
const prBody = pr.body || '';
const sha = pr.head.sha;
const hasComment = prBody.includes('<!--');
const state = hasComment ? 'failure' : 'success';
const description = hasComment
? 'PR description contains comment in "<!--". Please remove the comment manually.'
: 'PR description is valid.';

if (hasComment) {
core.setFailed(description);
}

await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: sha,
state: state,
target_url: pr.html_url,
description: description.substring(0, 140),
context: 'PR Description'
});