This repository has been archived by the owner on Mar 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
77 lines (65 loc) · 2.57 KB
/
pull-request.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Auto PR Creation
on:
push:
branches-ignore:
- master
- main
- "release/**"
- "hotfix/**"
- "feature/**"
permissions:
contents: read
pull-requests: write
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
jobs:
pull-request:
runs-on: [self-hosted, linux]
steps:
- name: Cleanup Repo
run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE"
- uses: actions/[email protected]
with:
fetch-depth: 1
- uses: juliangruber/[email protected]
id: findPr
with:
branch: ${{github.ref_name}}
- if: ${{steps.findPr.outputs.number != ''}}
run: |
echo "Pull request already exists with id: ${{steps.findPr.outputs.number}}"
echo "URL: https://github.com/${{github.repository}}/pull/${{steps.findPr.outputs.number}}"
- if: ${{steps.findPr.outputs.number == ''}}
id: pr-template
uses: juliangruber/[email protected]
with:
path: ./.github/PULL_REQUEST_TEMPLATE.md
- if: ${{steps.findPr.outputs.number == ''}}
run: echo "COMMIT_MSG=$(git log -1 --pretty=%B)" >> "$GITHUB_ENV"
- if: ${{steps.findPr.outputs.number == ''}}
id: open-pr
uses: repo-sync/[email protected]
with:
source_branch: "" # If blank, default: triggered branch
destination_branch: "main" # If blank, default: master
pr_assignee: ${{github.actor}} # Comma-separated list (no spaces)
pr_label: "auto-pr" # Comma-separated list (no spaces)
pr_draft: true # Creates pull request as draft
pr_title: ${{env.COMMIT_MSG}}
pr_body: ${{steps.pr-template.outputs.content}}
github_token: ${{github.token}}
- if: ${{steps.findPr.outputs.number == ''}}
name: New PR Details
run: |
echo "URL: ${{steps.open-pr.outputs.pr_url}}"
echo "PR: ${{steps.open-pr.outputs.pr_number}}"
echo "CF: ${{steps.open-pr.outputs.has_changed_files}}"
# TODO: Switch to actions/[email protected] if https://github.com/actions/labeler/pull/349 is merged and a release created
- if: ${{steps.findPr.outputs.number == ''}}
uses: credfeto/labeler@feature/pass-in-pull-request-or-issue
with:
repo-token: ${{secrets.SOURCE_PUSH_TOKEN}}
configuration-path: .github/labeler.yml
sync-labels: true
pr-number: ${{steps.open-pr.outputs.pr_number}}