From 39ec6b43a27c66ab876620d4e625cda53823c807 Mon Sep 17 00:00:00 2001 From: pixelass Date: Wed, 21 Feb 2024 15:17:45 +0100 Subject: [PATCH] chore: add workflow logic --- .github/workflows/set-pr-title.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/set-pr-title.yml b/.github/workflows/set-pr-title.yml index e69de29bb..78ceb7c74 100644 --- a/.github/workflows/set-pr-title.yml +++ b/.github/workflows/set-pr-title.yml @@ -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 }}