-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from DSpace/update_github_actions
Sync GitHub actions with other repos (DSpace & dspace-angular)
- Loading branch information
Showing
4 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This workflow checks open PRs for merge conflicts and labels them when conflicts are found | ||
name: Check for merge conflicts | ||
|
||
# Run this for all pushes (i.e. merges) to 'main' or maintenance branches | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'dspace-**' | ||
# So that the `conflict_label_name` is removed if conflicts are resolved, | ||
# we allow this to run for `pull_request_target` so that github secrets are available. | ||
pull_request_target: | ||
types: [ synchronize ] | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
triage: | ||
# Ensure this job never runs on forked repos. It's only executed for 'DSpace/RestContract' | ||
if: github.repository == 'dspace/restcontract' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
# See: https://github.com/prince-chrismc/label-merge-conflicts-action | ||
- name: Auto-label PRs with merge conflicts | ||
uses: prince-chrismc/label-merge-conflicts-action@v3 | ||
# Ignore any failures -- may occur (randomly?) for older, outdated PRs. | ||
continue-on-error: true | ||
# Add "merge conflict" label if a merge conflict is detected. Remove it when resolved. | ||
# Note, the authentication token is created automatically | ||
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token | ||
with: | ||
conflict_label_name: 'merge conflict' | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
conflict_comment: | | ||
Hi @${author}, | ||
Conflicts have been detected against the base branch. | ||
Please [resolve these conflicts](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/about-merge-conflicts) as soon as you can. Thanks! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# This workflow will attempt to port a merged pull request to | ||
# the branch specified in a "port to" label (if exists) | ||
name: Port merged Pull Request | ||
|
||
# Only run for merged PRs against the "main" or maintenance branches | ||
# We allow this to run for `pull_request_target` so that github secrets are available | ||
# (This is required when the PR comes from a forked repo) | ||
on: | ||
pull_request_target: | ||
types: [ closed ] | ||
branches: | ||
- main | ||
- 'dspace-**' | ||
|
||
permissions: | ||
contents: write # so action can add comments | ||
pull-requests: write # so action can create pull requests | ||
|
||
jobs: | ||
port_pr: | ||
runs-on: ubuntu-latest | ||
# Don't run on closed *unmerged* pull requests | ||
if: github.event.pull_request.merged | ||
steps: | ||
# Checkout code | ||
- uses: actions/checkout@v4 | ||
# Port PR to other branch (ONLY if labeled with "port to") | ||
# See https://github.com/korthout/backport-action | ||
- name: Create backport pull requests | ||
uses: korthout/backport-action@v2 | ||
with: | ||
# Trigger based on a "port to [branch]" label on PR | ||
# (This label must specify the branch name to port to) | ||
label_pattern: '^port to ([^ ]+)$' | ||
# Title to add to the (newly created) port PR | ||
pull_title: '[Port ${target_branch}] ${pull_title}' | ||
# Description to add to the (newly created) port PR | ||
pull_description: 'Port of #${pull_number} by @${pull_author} to `${target_branch}`.' | ||
# Copy all labels from original PR to (newly created) port PR | ||
# NOTE: The labels matching 'label_pattern' are automatically excluded | ||
copy_labels_pattern: '.*' | ||
# Skip any merge commits in the ported PR. This means only non-merge commits are cherry-picked to the new PR | ||
merge_commits: 'skip' | ||
# Use a personal access token (PAT) to create PR as 'dspace-bot' user. | ||
# A PAT is required in order for the new PR to trigger its own actions (for CI checks) | ||
github_token: ${{ secrets.PR_PORT_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This workflow runs whenever a new pull request is created | ||
name: Pull Request opened | ||
|
||
# Only run for newly opened PRs against the "main" or maintenance branches | ||
# We allow this to run for `pull_request_target` so that github secrets are available | ||
# (This is required to assign a PR back to the creator when the PR comes from a forked repo) | ||
on: | ||
pull_request_target: | ||
types: [ opened ] | ||
branches: | ||
- main | ||
- 'dspace-**' | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
automation: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Assign the PR to whomever created it. This is useful for visualizing assignments on project boards | ||
# See https://github.com/toshimaru/auto-author-assign | ||
- name: Assign PR to creator | ||
uses: toshimaru/[email protected] |