-
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (37 loc) · 1.29 KB
/
enforce_pr_title.yml
File metadata and controls
42 lines (37 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Xodium CI/CD - Enforce PR Title
on:
pull_request_target:
types: [ opened ]
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
enforce-title:
runs-on: ubuntu-latest
if: github.actor != 'renovate[bot]'
steps:
- id: enforce_title
name: Set PR title to branch name
if: github.event.pull_request.title != github.event.pull_request.head.ref
uses: actions/github-script@v9
with:
script: |
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
title: context.payload.pull_request.head.ref
});
- id: notify_user
name: Notify User
if: steps.enforce_title.outputs.changed == true
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
gh pr comment "$PR_NUMBER" --repo "$REPO" --body \
"🤖 I've automatically updated the PR title to match the branch name: \`$BRANCH_NAME\`. This helps maintain consistency in our git history."