Skip to content

[Pull Request] New script for github action that check latest commit date #3

[Pull Request] New script for github action that check latest commit date

[Pull Request] New script for github action that check latest commit date #3

name: Check Pull Request Title
on:
pull_request:
types:
- opened
jobs:
check_title:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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 "./ToolKits/Actions/pr_auto_rename.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"