Repository navigation
67 lines (58 loc) · 2.41 KB
/
Copy pathcreate-pull-request.yml
File metadata and controls
67 lines (58 loc) · 2.41 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Create Pull Request
on:
workflow_dispatch:
inputs:
base:
description: The base branch to pull into
required: true
default: 'main'
user_name:
description: The user name requesting the pull.
required: false
default: ''
jobs:
create-pull-request:
runs-on: ubuntu-latest
steps:
- name: Get Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ secrets.APPLICATION_ID }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: bahmutov/npm-install@v1
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Extract changelog
shell: bash
run: |
git switch ${{ github.event.inputs.base }}
git switch -
CHANGELOG=$(./build/script/create-release-notes --from ${{ github.event.inputs.base }} --group)
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
echo "changelog=$CHANGELOG" >> $GITHUB_OUTPUT
id: extract_changelog
# This action is deprecated and should be replaced
# with something like GitHub CLI.
- name: pull-request
uses: repo-sync/pull-request@v2
with:
github_token: ${{ steps.get_workflow_token.outputs.token }}
source_branch: ${{ steps.extract_branch.outputs.branch }}
destination_branch: ${{ github.event.inputs.base }}
pr_title: "Pulling ${{ steps.extract_branch.outputs.branch }} into ${{ github.event.inputs.base }}"
pr_body: |
# Merge ${{ steps.extract_branch.outputs.branch }} into ${{ github.event.inputs.base }}
${{ steps.extract_changelog.outputs.changelog }}
pr_reviewer: "@charcoalphp/reviewers" # Comma-separated list (no spaces
pr_label: release,automatic-pr # Comma-separated list (no spaces)
pr_draft: false # Creates pull request as draft
pr_allow_empty: false # Creates pull request even if there are no changes