Skip to content

Commit

Permalink
chore: adjust workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelass committed Feb 21, 2024
1 parent 42407f5 commit 17ac9f6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/set-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
# Fetches the entire commit history so that we can access the first commit
fetch-depth: 0

- 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
run: |
# Get the SHA of the first commit in the PR
FIRST_COMMIT_SHA=$(git log --reverse --format="%H" "${{ github.event.pull_request.base.sha }}..HEAD" | head -n 1)
# Get the message of the first commit in the PR
FIRST_COMMIT_MESSAGE=$(git log -n 1 --format=%B "$FIRST_COMMIT_SHA")
echo "FIRST_COMMIT_MESSAGE=$FIRST_COMMIT_MESSAGE" >> $GITHUB_ENV
- name: Update PR title
run: |
gh pr edit "$PR_NUMBER" --title "$FIRST_COMMIT_MESSAGE"
run: gh pr edit "$PR_NUMBER" --title "$FIRST_COMMIT_MESSAGE"
env:
FIRST_COMMIT_MESSAGE: ${{ env.FIRST_COMMIT_MESSAGE }}
GITHUB_TOKEN: ${{ secrets.PIXELASS_PAT_BLIBLA }}
Expand Down

0 comments on commit 17ac9f6

Please sign in to comment.