Skip to content

Commit

Permalink
chore: add workflow logic
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelass committed Feb 21, 2024
1 parent 990e696 commit 39ec6b4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/set-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Set PR Title to First Commit Message

on:
pull_request:
types: [opened, synchronize]

jobs:
set-pr-title:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get first commit message
run: echo "FIRST_COMMIT_MESSAGE=$(git log --format=%B -n 1 $(git rev-list --max-parents=0 HEAD))" >> $GITHUB_ENV

- name: Update PR title
run: |
gh pr edit "$PR_NUMBER" --title "$FIRST_COMMIT_MESSAGE"
env:
FIRST_COMMIT_MESSAGE: ${{ env.FIRST_COMMIT_MESSAGE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}

0 comments on commit 39ec6b4

Please sign in to comment.