Skip to content

[Pull Request] Script Engine Integration and Functional Improvements #4

[Pull Request] Script Engine Integration and Functional Improvements

[Pull Request] Script Engine Integration and Functional Improvements #4

name: Format Pull Request Title
on:
pull_request:
types:
- opened
jobs:
check_title:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Comment on Pull Request
run: |
pull_request_number=${{ github.event.pull_request.number }}
current_title="${{ github.event.pull_request.title }}"
message_body="The origin title of this PR is: '$current_title'. GitHub Action is checking and format it ..."
curl -H "Authorization: Bearer ${{ secrets.GITHUBTOKEN }}" \
-H "Content-Type: application/json" \
-X POST \
-d '{"body":"'"$message_body"'"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/$pull_request_number/comments"
- name: Update Pull Request Title
run: |
pull_request_number=${{ github.event.pull_request.number }}
current_title="${{ github.event.pull_request.title }}"
updated_title=$(python3 "./.github/scripts/pr_format.py" "$current_title")
curl -X PATCH \
-H "Authorization: Bearer ${{ secrets.GITHUBTOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{ "title": "'"$updated_title"'" }' \
"https://api.github.com/repos/${{ github.repository }}/pulls/$pull_request_number"