Skip to content

gallery view

gallery view #99

Workflow file for this run

name: PR Validation and Comment Bot
# Trigger the workflow on pull request creation
on:
pull_request:
types: [opened]
jobs:
check_branch:
runs-on: ubuntu-latest
steps:
- name: Check if PR is from main or master
run: |
if [[ "${{ github.event.pull_request.head.ref }}" == "main" || "${{ github.event.pull_request.head.ref }}" == "master" ]]; then
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-d '{"body": "### :warning: Warning: Create a new branch!\n\nIt looks like this pull request is from the `main` or `master` branch, which is not allowed.. To keep the repository organized and avoid conflicts, you have to create a new branch. So please follow these steps:\n\n1. Close this PR.\n2. Create a new branch using `git checkout -b your-branch-name`.\n3. Make your changes in that branch and open a new PR.\n\nThank you!"}'
exit 1
fi
- name: Comment on valid PR
if: ${{ success() }}
run: |
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-d '{"body": "### Thank you for opening a Pull Request!\n\nYour contribution is highly appreciated. Please make sure your PR meets the following guidelines:\n\n1. Follow our [contribution guidelines](https://link-to-guidelines).\n2. Ensure all code is properly documented.\n3. Add tests for your new code if applicable.\n4. Make sure you mention the issue # for which you were assigned.\n\nThank you for your contribution!"}'