Skip to content

feat: Added the CI workflow for the github action #5

feat: Added the CI workflow for the github action

feat: Added the CI workflow for the github action #5

name: "PR Title Checker"
on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited
- closed
permissions:
contents: write
pull-requests: write
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Run PR Title Checker
id: title-check
uses: thehanimo/pr-title-checker@v1.4.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pass_on_octokit_error: false
configuration_path: .github/pr-title-checker-config.json
- name: pt title satisfied
if: success()
run: |
gh issue comment ${{ github.event.pull_request.number }} -R ${{ github.repository }} --body "Thank you `${{github.actor}}`! Your PR title meets our guidelines."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Close PR if title is invalid
if: failure()
run: |
gh pr close ${{ github.event.pull_request.number }} -R ${{ github.repository }}
gh issue comment ${{ github.event.pull_request.number }} -R ${{ github.repository }} --body $'Hello `${{github.actor}}` Thank you for your PR. Unfortunately, it doesn\'t meet our quality checks.\n\nPlease ensure you follow our contribution guidelines. The PR title should match the required format.\n\nFor example, it should be like: `fix-#124: Added responsiveness to the Home page screen.`\n\nIf you have any query kindly check our [contributor guidelines](https://github.com/krishnaacharyaa/wanderlust/blob/main/.github/CONTRIBUTING.md).'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Reopen PR if title is corrected
if: github.event.action == 'edited' && success()
run: |
if [ "${{ github.event.pull_request.state }}" == "closed" ]; then
gh pr reopen ${{ github.event.pull_request.number }} -R ${{ github.repository }}
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}