uses: ExpediaGroup/github-helpers@v1
with:
helper: < HELPER NAME >
...
github_token: ${{ secrets.GITHUB_TOKEN }}The helper and github_token inputs are required for all helpers. Additional inputs vary by helper. Each helper file in src/helpers contains an interface that defines which additional inputs are required or optional. If a required input is ommitted, the helper will throw a descriptive error.
Input interface in src/helpers/set-commit-status.ts:
export class SetCommitStatus {
sha = ''; // required
context = ''; // required
state = ''; // required
description?: string; // optional
target_url?: string; // optional
}Github Actions workflow invocation:
uses: ExpediaGroup/github-helpers@v1
with:
helper: set-commit-status
sha: ${{ github.event.pull_request.head.sha }}
context: My Context
state: success
description: My Description
github_token: ${{ secrets.GITHUB_TOKEN }}Each of the following helpers are defined in a file of the same name in src/helpers:
- Adds one or more labels to a PR
- Upon PR review, adds a
CORE APPROVEDlabel if the reviewer is a part of the provided Github team, otherwise adds thePEER APPROVEDlabel
- Approves a PR
- Randomly assigns members of a github team to review a PR. If
loginis provided, it does nothing if that user is already part of the team - You can also pass a
slack_webhook_urlto notify the assignees that they are assigned to the PR!
- Opens a pull request
- Creates a Project card into your GitHub Project repository by providing a
project_nameandproject_destination_column_namein which the card should be created. - If
noteis provided, it will add that information into the card. If it is not provided, it will use the PR information details to populate it. - Useful when opening a pull request and want to track its information details into a GitHub Project.
- Checks whether PR title matches a certain regular expression
- Comments on a pull request or other issue
- Deletes a Github deployment and environment
- Returns
trueif specified file paths have changed for a PR, andfalseotherwise
- Returns a job matrix JSON for dynamically running workflows only for changed file paths
- Can be used to parallelize similar jobs, which can be useful in a monorepo environment. More information on matrix strategies can be found here
- In this example, a multi-package repo splits its builds dynamically based on which packages are modified in the pull request. These builds run in parallel, and the final
build-statusjob is used to determine the overall success/failure result, contingent on all of the individualbuildjobs passing. The helper returns a JSON object of this format:
{
"include": [
{ "path": "package-name" }
]
}Additionally, the following parameters can be used for additional control over the resulting matrix:
override_filter_pathsdefines paths that, if modified, will override the filter and return a matrix including all packages- example:
override_filter_paths: package.json,package-lock.json
- example:
paths_no_filterdefines paths that should be included in the matrix regardless of if they've been modifiedbatchesdefines a fixed number of matrix jobs to run for the workflow
- Returns a comma-separated list of changed files for a PR
- Creates a new in-progress Github "deployment" for a commit. More information on Github deployment events can be found here
- Manages a queue for PRs as follows:
- Adding the
READY TO MERGElabel to a PR will add the PR to the "merge queue", represented by aQUEUED FOR MERGE #Xlabel. RemovingREADY TO MERGEwill remove this label and thus remove the PR from the queue. - If a PR is first in the queue, the
QUEUE CHECKERcommit status will be set tosuccess, and it will bependingotherwise. Github's branch protection rules can be used to ensure this requirement is met prior to merging. - Merging a PR will update the positions of all PRs in the queue.
- Adding the
JUMP THE QUEUElabel to a PR will make that PR first in the queue immediately. - When a PR is merged, it automatically updates the first-queued PR with the default branch.
- Adding the
- You can also pass
loginandslack_webhook_urlto notify the PR author when they are in the 1st position of the merge queue.
- Moves a GitHub Project card to a new column, using the
project_origin_column_nameandproject_destination_column_nameyou provide. - In order to move a card from one place to another, it must already exist.
- Sets a "pipeline" commit status to green for all open PRs
- Merges the default branch into the pull request that has the
QUEUED FOR MERGE #1label
- Removes a label from a PR
- Removes a PR from the merge queue if it has a stale failing status check. A PR check is considered stale if it is older than the provided number of
seconds.
- Reruns all of the latest workflow checks on a pull request (helpful if they were cancelled for some reason, either manually or due to rate limiting, for example).
- Sets a commit status
- Updates a Github deployment status
- Determines whether the pipeline is clear for a PR. This means it will set the "pipeline" commit status to
pendingif there is an in-progress production deployment for the repo, andsuccessotherwise.
This project is available under the Apache 2.0 License.
Copyright 2021 Expedia, Inc.