Skip to content

Commit 1223e3c

Browse files
authored
Merge pull request DSpace#2406 from tdonohue/update_actions
Add GitHub action to automatically create a port PR (based on label) & minor bug fixes
2 parents 44b197a + d75d12b commit 1223e3c

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/label_merge_conflicts.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
# See: https://github.com/prince-chrismc/label-merge-conflicts-action
2626
- name: Auto-label PRs with merge conflicts
2727
uses: prince-chrismc/label-merge-conflicts-action@v3
28+
# Ignore any failures -- may occur (randomly?) for older, outdated PRs.
29+
continue-on-error: true
2830
# Add "merge conflict" label if a merge conflict is detected. Remove it when resolved.
2931
# Note, the authentication token is created automatically
3032
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow will attempt to port a merged pull request to
2+
# the branch specified in a "port to" label (if exists)
3+
name: Port merged Pull Request
4+
5+
# Only run for merged PRs against the "main" or maintenance branches
6+
# We allow this to run for `pull_request_target` so that github secrets are available
7+
# (This is required when the PR comes from a forked repo)
8+
on:
9+
pull_request_target:
10+
types: [ closed ]
11+
branches:
12+
- main
13+
- 'dspace-**'
14+
15+
permissions:
16+
contents: write # so action can add comments
17+
pull-requests: write # so action can create pull requests
18+
19+
jobs:
20+
port_pr:
21+
runs-on: ubuntu-latest
22+
# Don't run on closed *unmerged* pull requests
23+
if: github.event.pull_request.merged
24+
steps:
25+
# Checkout code
26+
- uses: actions/checkout@v3
27+
# Port PR to other branch (ONLY if labeled with "port to")
28+
# See https://github.com/korthout/backport-action
29+
- name: Create backport pull requests
30+
uses: korthout/backport-action@v1
31+
with:
32+
# Trigger based on a "port to [branch]" label on PR
33+
# (This label must specify the branch name to port to)
34+
label_pattern: '^port to ([^ ]+)$'
35+
# Title to add to the (newly created) port PR
36+
pull_title: '[Port ${target_branch}] ${pull_title}'
37+
# Description to add to the (newly created) port PR
38+
pull_description: 'Port of #${pull_number} by @${pull_author} to `${target_branch}`.'
39+
# Copy all labels from original PR to (newly created) port PR
40+
# NOTE: The labels matching 'label_pattern' are automatically excluded
41+
copy_labels_pattern: '.*'
42+
# Use a personal access token (PAT) to create PR as 'dspace-bot' user.
43+
# A PAT is required in order for the new PR to trigger its own actions (for CI checks)
44+
github_token: ${{ secrets.PR_PORT_TOKEN }}

0 commit comments

Comments
 (0)