-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
52 lines (51 loc) · 1.53 KB
/
action.yml
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
name: 'Create Pull Request'
description: 'Create a Pull Request'
inputs:
directory:
description: 'Directory name'
required: true
branch-name:
description: 'Branch name'
required: true
commit-message:
description: 'Commit message'
required: true
title:
description: 'PR title'
required: true
description:
description: 'PR description'
required: false
default: ''
draft:
description: 'Create a Draft PR'
required: false
default: 'false'
token:
description: 'Personal Access Token'
required: false
default: ${{ github.token }}
outputs:
new-pr-url:
description: 'URL of Created PR'
value: ${{ steps.pull-request.outputs.PR_URL }}
runs:
using: "composite"
steps:
- name: Create Pull Request
id: pull-request
run: |
git checkout -b ${{ inputs.branch-name }}
git config user.email "${{ github.actor }}@users.noreply.github.com"
git config user.name "${{ github.actor }}"
git commit -am "${{ inputs.commit-message }}"
git push -u origin ${{ inputs.branch-name }}
if [ '${{ inputs.draft }}' = 'true' ]; then
echo "PR_URL=$(gh pr create --title "${{ inputs.title }}" --body "${{ inputs.description }}" --draft)" >> $GITHUB_OUTPUT
else
echo "PR_URL=$(gh pr create --title "${{ inputs.title }}" --body "${{ inputs.description }}")" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ inputs.token }}
working-directory: ${{ inputs.directory }}
shell: bash