diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index c41d01f5b8..ed2b95b171 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,7 +4,7 @@ **Checklist:** - [ ] You have [signed off your commits](https://www.kubeflow.org/docs/about/contributing/#sign-off-your-commits) - [ ] Ensure you follow best practices from our guide. [Contributing](https://github.com/kubeflow/website/blob/master/content/en/docs/about/contributing.md). -- [] You have included screenshots when changing the website style or adding a new page. +- [ ] You have included screenshots when changing the website style or adding a new page. **Description of your changes:** diff --git a/.github/workflows/pr_title_check.yaml b/.github/workflows/pr_title_check.yaml index 0845901a0c..8bffef5c6f 100644 --- a/.github/workflows/pr_title_check.yaml +++ b/.github/workflows/pr_title_check.yaml @@ -11,12 +11,23 @@ jobs: - name: Check PR Title Format env: PR_TITLE: ${{ github.event.pull_request.title }} + PR_NUMBER: ${{ github.event.pull_request.number }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | VALID_COMPONENTS="central-dashboard|katib|kserve|model-registry|notebooks|pipelines|spark-operator|trainer|gsoc|website|community" if [[ ! "$PR_TITLE" =~ ^($VALID_COMPONENTS):\ .+ ]]; then echo "❌ PR title does not follow the correct format: 'component_name: description'" echo "Component value must be one of these central-dashboard|katib|kserve|model-registry|notebooks|pipelines|spark-operator|trainer|gsoc|website|community" echo "Example: model-registry: Add model registry UI Installation instructions" + + COMMENT_BODY="⚠️ **Invalid PR Title** ⚠️\n\nYour PR title \`$PR_TITLE\` does not match the required format: \`component_name: description\`.\n\n**Allowed components (case sensitive):** \`central-dashboard, katib, kserve, model-registry, notebooks, pipelines, spark-operator, trainer, gsoc, website, community\`\n\n✅ **Example:** \`model-registry: Add model registry UI Installation instructions\`\n\nPlease update your PR title accordingly by either using GITHUB GUI or by usinge \`/retitle component_name: description\` as stated above." + + # Post the comment to the PR using GitHub API + curl -s -H "Authorization: token $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + -X POST \ + https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments \ + -d "{\"body\": \"$COMMENT_BODY\"}" exit 1 fi echo "✅ PR title format is correct."