Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18503] Add mirror and create PR external actions #25

Merged
merged 2 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The main idea is to collect every repeated or generic step of any CI to have a s
- [Dependencies built](#dependencies-built)
- [Artifacts uploaded](#artifacts-uploaded)
- [Generate artifacts manually](#generate-artifacts-manually)
- [External Actions](#external-actions)

---

Expand Down Expand Up @@ -221,3 +222,19 @@ Then, run the `manual_build` workflow with these arguments:
- `artifacts_name_postfix`: Postfix of the name of the artifact to generate.

The result artifacts will be called `<artifacts_name_prefix>_<os>_<cmake_build_type><artifacts_name_postfix>`.

## External Actions

This repository also includes a wrapper around the external actions being used by eProsima CI workflows.
Thus, the maintainability and upgrading of these actions is performed in a single step.
Find below the external actions listed:

| External Action | Description | LICENSE |
|---|---|---|
| [action-download-artifact](external/action-download-artifact/action.yml) | Download and extract an artifact | MIT license |
| [checkout](external/checkout/action.yml) | Checkout repository | MIT license |
| [codecov-action](external/codecov-action/action.yml) | Upload coverage report to codecov.io | MIT license |
| [create-pull-request](external/create-pull-request/action.yml) | Create PR | MIT license |
| [mirror-branch-action](external/mirror-branch-action/action.yml) | Mirror branch within the same repository | Apache-2.0 license |
| [upload-artifact](external/upload-artifact/action.yml) | Upload build artifact | MIT license |
| [wait-on-check-action](external/wait-on-check-action/action.yml) | Wait on certain check | MIT license |
2 changes: 1 addition & 1 deletion external/checkout/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ runs:
using: composite
steps:

- name: Download dependency
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: ${{ inputs.repository }}
Expand Down
115 changes: 115 additions & 0 deletions external/create-pull-request/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: 'Create Pull Request'
description: 'https://github.com/peter-evans/create-pull-request'

inputs:

token:
description: 'GITHUB_TOKEN or a `repo` scoped Personal Access Token (PAT)'
default: ${{ github.token }}
path:
description: >
Relative path under $GITHUB_WORKSPACE to the repository.
Defaults to $GITHUB_WORKSPACE.
add-paths:
description: >
A comma or newline-separated list of file paths to commit.
Paths should follow git's pathspec syntax.
Defaults to adding all new and modified files.
commit-message:
description: 'The message to use when committing changes.'
default: '[create-pull-request] automated change'
committer:
description: >
The committer name and email address in the format `Display Name <[email protected]>`.
Defaults to the GitHub Actions bot user.
default: 'GitHub <[email protected]>'
author:
description: >
The author name and email address in the format `Display Name <[email protected]>`.
Defaults to the user who triggered the workflow run.
default: '${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>'
signoff:
description: 'Add `Signed-off-by` line by the committer at the end of the commit log message.'
default: false
branch:
description: 'The pull request branch name.'
default: 'create-pull-request/patch'
delete-branch:
description: >
Delete the `branch` when closing pull requests, and when undeleted after merging.
Recommend `true`.
default: false
branch-suffix:
description: 'The branch suffix type when using the alternative branching strategy.'
base:
description: >
The pull request base branch.
Defaults to the branch checked out in the workflow.
push-to-fork:
description: >
A fork of the checked out parent repository to which the pull request branch will be pushed.
e.g. `owner/repo-fork`.
The pull request will be created to merge the fork's branch into the parent's base.
title:
description: 'The title of the pull request.'
default: 'Changes by create-pull-request action'
body:
description: 'The body of the pull request.'
default: 'Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action'
body-path:
description: 'The path to a file containing the pull request body. Takes precedence over `body`.'
labels:
description: 'A comma or newline separated list of labels.'
assignees:
description: 'A comma or newline separated list of assignees (GitHub usernames).'
reviewers:
description: 'A comma or newline separated list of reviewers (GitHub usernames) to request a review from.'
team-reviewers:
description: >
A comma or newline separated list of GitHub teams to request a review from.
Note that a `repo` scoped Personal Access Token (PAT) may be required.
milestone:
description: 'The number of the milestone to associate the pull request with.'
draft:
description: 'Create a draft pull request. It is not possible to change draft status after creation except through the web interface'
default: false

outputs:

pull-request-number:
description: 'The pull request number'
pull-request-url:
description: 'The URL of the pull request.'
pull-request-operation:
description: 'The pull request operation performed by the action, `created`, `updated` or `closed`.'
pull-request-head-sha:
description: 'The commit SHA of the pull request branch.'

runs:
using: composite
steps:

- name: Create PR
uses: peter-evans/create-pull-request@v5
with:
token: ${{ inputs.token }}
path: ${{ inputs.path }}
add-paths: ${{ inputs.add-paths }}
commit-message: ${{ inputs.commit-message }}
committer: ${{ inputs.committer }}
author: ${{ inputs.author }}
signoff: ${{ inputs.signoff }}
branch: ${{ inputs.branch }}
delete-branch: ${{ inputs.delete-branch }}
branch-suffix: ${{ inputs.branch-suffix }}
base: ${{ inputs.base }}
push-to-fork: ${{ inputs.push-to-fork }}
title: ${{ inputs.title }}
body: ${{ inputs.body }}
body-path: ${{ inputs.body-path }}
labels: ${{ inputs.labels }}
assignees: ${{ inputs.assignees }}
reviewers: ${{ inputs.reviewers }}
team-reviewers: ${{ inputs.team-reviewers }}
milestone: ${{ inputs.milestone }}
draft: ${{ inputs.draft }}
25 changes: 25 additions & 0 deletions external/mirror-branch-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Mirror Branch'
description: 'https://github.com/google/mirror-branch-action'

inputs:

github-token:
description: 'This should be `secrets.GITHUB_TOKEN`.'
required: true
source:
description: 'Name of the source branch'
required: true
dest:
description: 'Name of the destination branch'
required: true

runs:
using: composite
steps:

- name: Mirror branch
uses: google/[email protected]
with:
github-token: ${{ inputs.github-token }}
source: ${{ inputs.source }}
dest: ${{ inputs.dest }}