Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: set pr title #50

Merged
merged 5 commits into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/set-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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
with:
# Fetches the entire commit history so that we can access the first commit
fetch-depth: 0

- name: Get first commit message
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"
env:
FIRST_COMMIT_MESSAGE: ${{ env.FIRST_COMMIT_MESSAGE }}
GITHUB_TOKEN: ${{ secrets.PIXELASS_PAT_BLIBLA }}
PR_NUMBER: ${{ github.event.pull_request.number }}
Loading