Skip to content

Commit

Permalink
🔧 📝 Fix, Chore(Actions): Forget to checkout.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dynesshely committed Oct 17, 2023
1 parent 49681f0 commit 1515dcb
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions .github/workflows/pr-auto-rename.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
name: Check Pull Request Title

on:
pull_request:
types:
- opened
pull_request:
types:
- opened

jobs:
check_title:
runs-on: ubuntu-latest
check_title:
runs-on: ubuntu-latest

steps:
- 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 ..."
steps:
- uses: actions/checkout@v3

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: 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 ..."
- 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 -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"
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"
- 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"

0 comments on commit 1515dcb

Please sign in to comment.