This is a collection of reusable composite actions for GitHub Actions workflows.
- General usage
- Actions
We use semantic versioning. We will only push breaking changes to major updates. Minor versions are features, additions and improvements, and patch versions are bug fixes. We recommend using a major version.
Version | Constraint |
---|---|
v4 | >= v4.0.0 && < v5.0.0 |
v4.0 | >= v4.0.0 && < v4.1.0 |
v4.0.0 | v4.0.0 |
You can also use main
to always use the latest actions, but this is not
recommended as this will also include breaking changes.
- uses: myparcelnl/actions/yarn-install@v4
Will use every minor and patch update within v2.x.x
.
- uses: myparcelnl/actions/yarn-install@v4
Will use every patch update within v2.1.x
.
Generate credentials for a GitHub app.
- uses: myparcelnl/actions/setup-app-credentials@v4
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: namespace/any-other-action
with:
token: ${{ steps.setup-app-credentials.outputs.token }}
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | app-id |
The app ID of the app. | ${{ secrets.APP_ID }} |
– |
Yes | private-key |
The private key of the app. | ${{ secrets.APP_PRIVATE_KEY }} |
– |
As well as the inputs from actions/create-github-app-token@v1.
Name | Description | Example |
---|---|---|
name |
The name of the app. | my-app |
token |
The GitHub token of the app. | *** |
git-name |
The name to use with git. | my-app[bot] |
git-email |
The email to use with git. | my-app[bot]@users.noreply.github.com |
See also setup-git-credentials for setting up git using a GitHub app.
Generate credentials for a GitHub app. Uses [setup-app-credentials], then sets authentication data in git config and environment variables GIT_USER
, GIT_AUTHOR_NAME
, GIT_AUTHOR_EMAIL
, GIT_COMMITTER_NAME
and GIT_COMMITTER_EMAIL
.
- uses: myparcelnl/actions/setup-git-credentials@v4
id: credentials
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: namespace/any-other-action
with:
token: ${{ steps.credentials.outputs.token }}
The same inputs as setup-app-credentials.
The same outputs as setup-app-credentials.
Setup AWS credentials for use with other AWS actions.
- uses: myparcelnl/actions/aws-setup@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | aws-access-key-id |
The AWS access key ID. | ${{ secrets.AWS_ACCESS_KEY_ID }} |
– |
Yes | aws-secret-access-key |
The AWS secret access key. | ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
– |
Yes | aws-region |
The AWS region. | eu-west-1 |
– |
Sync a directory to an S3 bucket. Must be run after [aws-setup].
- uses: myparcelnl/actions/aws-setup@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- uses: myparcelnl/actions/aws-s3-sync@v4
with:
source: dist
bucket: my-bucket
delete: true
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | source |
The directory to sync. | dist |
– |
Yes | bucket |
Name of the S3 bucket to sync to. | ${{ secrets.AWS_BUCKET }} |
– |
No | delete |
Delete files that exist in the destination but not in the source during sync. | true |
false |
Uses [Volta] or actions/setup-node to set up Node.js. If Volta is present in the project, it will use the version from
volta.node
in package.json
. If Volta is not present, it will use the fallback version with actions/setup-node.
If node-version
is passed, it will use that version instead of Volta or the fallback version.
- uses: myparcelnl/actions/setup-node@v4
with:
# Omit to use Volta or fallback version.
node-version: 21
Includes the cache
and cache-dependency-path
inputs from actions/setup-node, which only apply when not using Volta.
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | node-version |
The Node.js version to use. Leave empty to use Volta version or fallback default version. (20) | 21 |
– |
Name | Description | Example |
---|---|---|
node-version |
The node version that is used. | 20.3.1 |
- Runs setup-node
- Handles
node_modules
cache - Runs
npm ci
- uses: myparcelnl/actions/npm-install@v4
with:
node-version: 20
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | node-version |
The Node.js version to use | 19 |
– |
Can be used with Yarn 1 as well as Yarn 2, 3 and 4 (berry).
- Runs setup-node
- Determines yarn arguments based on yarn version
- Runs
yarn install <your-args>
- uses: myparcelnl/actions/yarn-install@v4
with:
node-version: 20
yarn-args: --ignore-scripts
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | node-version |
The Node.js version to use | 19 |
– |
No | yarn-args |
Arguments to use with yarn install | --ignore-scripts |
|
- Runs setup-node
- Installs pnpm
- Handles pnpm cache
- Runs
pnpm install
with the provided arguments and--frozen-lockfile
by default.
- uses: myparcelnl/actions/pnpm-install@v4
with:
node-version: 20
pnpm-version: 8.15.1
pnpm-args: |
--ignore-scripts
--store-dir /tmp/pnpm-store
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | node-version |
The Node.js version to use | 18 |
– |
No | pnpm-version |
The pnpm version to use | 7.4.0 |
8.15.1 |
No | pnpm-args |
Arguments to use with pnpm install. Can be multiline string. | --ignore-scripts |
– |
- Pulls
myparcelnl/php-xd
- You can change the php version by passing
php-version
.
- Handles composer cache
- Runs
composer install
with passed arguments
- You can add additional flags by passing the
composer-args
option.
- uses: myparcelnl/actions/composer-install@v4
with:
php-version: '8.0'
composer-args: |
--no-dev
--no-plugins
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | command |
The command to run | update |
install |
No | composer-args |
Additional flags to pass to composer install |
--no-scripts |
--no-scripts --no-plugins |
No | php-version |
The PHP version to use | 8.0 |
7.2 |
Name | Description | Example |
---|---|---|
image |
The image name that was used to install dependencies. Can be used in subsequent jobs. | ghcr.io/myparcelnl/php-xd:7.4-cli-alpine |
- Runs composer-install with
command: update
.
- uses: myparcelnl/actions/composer-update@v4
with:
php-version: '8.0'
composer-args: |
--no-dev
--no-plugins
Same as composer-install, but without command
.
Same as composer-install.
Run Behat through composer.
- Runs composer-install or uses the provided image.
- Runs
vendor/bin/behat
in container.
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | image |
PHP Docker image to use | 8.1 |
7.4 |
No | php-version |
PHP version to use. If image is set, this will be ignored. | php:8.1 |
– |
No | flags |
Additional flags to pass to Behat | --no-paths |
– |
No | php-args |
Arguments to pass to PHP. Should be a multiline string. | -dmemory_limit=2G |
– |
No | behat-args |
Arguments to pass to Behat. Should be a multiline string. | --tags=@api |
– |
Run Pest through composer.
- Runs composer-install.
- Runs
vendor/bin/pest
in container.
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | image |
PHP Docker image to use | 8.1 |
7.4 |
No | php-version |
PHP version to use. If image is set, this will be ignored. | php:8.1 |
– |
No | php-args |
Arguments to pass to PHP. Should be a multiline string. | -dpcov.enabled=0 |
– |
No | pest-args |
Arguments to pass to Pest. Should be a multiline string. | --retry |
– |
Run PHPStan through composer.
- Runs composer-install or uses the provided image.
- Runs
vendor/bin/phpstan
in container.
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | command |
The PHPStan command to run. | analyse |
analyse |
No | config-file |
PHPStan configuration file | phpstan.neon |
– |
No | cache-dir |
PHPStan cache directory | ./tmp/phpstan |
/tmp/phpstan |
No | cache-hash |
Hash to use for caching | ${{ hashFiles('src/**/*') }} |
${{ hashFiles('**/*.php') }} |
No | image |
PHP Docker image to use | php:8.1 |
– |
No | php-version |
PHP version to use. If image is set, this will be ignored. | 8.1 |
7.4 |
No | php-args |
Arguments to pass to PHP. Should be a multiline string. | -dpcov.enabled=0 |
– |
No | phpstan-args |
Arguments to pass to PHPStan. Should be a multiline string. | --level=7 |
– |
Replacement for codecov/codecov-action that supports glob input in files
.
- Runs tj-actions/glob with the provided
files
input. - Runs codecov/codecov-action with the resolved files.
- uses: myparcelnl/actions/codecov-coverage@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit,frontend
files: |
frontend/**/coverage/*.xml
- uses: myparcelnl/actions/codecov-coverage@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit,backend
files: |
backend/**/coverage/*.xml
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | files |
Glob pattern or list of files to find results files, separated by newlines | coverage/*.xml |
– |
The following inputs are copied from the codecov/codecov-action action:
token
flags
name
plugin
plugins
version
working-directory
Replacement for codecov/test-results-action that supports glob input in files
.
- Runs tj-actions/glob with the provided
files
input. - Runs codecov/test-results-action with the resolved files.
- uses: myparcelnl/actions/codecov-test-results@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit,frontend
files: |
frontend/**/junit.xml
- uses: myparcelnl/actions/codecov-test-results@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit,backend
files: |
backend/**/junit.xml
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | files |
Glob pattern or list of files to find results files, separated by newlines | **/junit.xml |
– |
The following inputs are copied from the codecov/test-results-action action:
token
flags
name
version
working-directory
Builds a docker image from a Dockerfile. Build results are cached between jobs using mode=gha
.
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | image |
Image name | my-name/my-image |
${{ github.repository }} |
No | dockerfile |
Path to dockerfile | ./docker/prod.Dockerfile |
Dockerfile |
No | context |
Directory to build from | ./docker |
. |
No | target |
Target stage to build | prod |
– |
No | registry |
Packages registry to use | docker.io |
ghcr.io |
No | registry-username |
Username to log into registry with | ${{ secrets.DOCKER_REGISTRY_USER }} |
${{ github.actor }} |
Yes | registry-password |
Password to log into registry with | ${{ secrets.DOCKER_REGISTRY_PASS }} |
– |
Also outputs version
, tags
, labels
, annotations
, json
from docker/metadata-action.
Name | Description | Example |
---|---|---|
tagged-image |
Created image name with tag | my-name/my-image:main |
- uses: myparcelnl/actions/build-docker-image@v4
id: docker
with:
image: myparcelnl/php-sdk
registry-username: ${{ github.actor }}
registry-password: ${{ secrets.GITHUB_TOKEN }}
- run: docker run ${{ steps.docker.outputs.tagged-image }}
Pulls and caches a docker image. Outputs the image name that was input to provide an easy way to not have to repeat the image name in the rest of your workflow.
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | image |
Image name | my-name/my-image |
– |
No | cache-directory |
Directory to store cache in | /path/to/cache |
~/.docker-cache |
Name | Description | Example |
---|---|---|
image |
Image name | my-name/my-image |
- uses: myparcelnl/actions/pull-docker-image@v4
id: pull
with:
image: ghcr.io/myparcelnl/php-xd:7.4
- run: docker run ${{ steps.pull.outputs.image }}
Run semantic-release. Requires npm dependencies to be installed. Outputs information on the release that was just made (or not). Additional tokens like NPM_TOKEN can be passed via the environment.
- uses: myparcelnl/actions/semantic-release@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
dry-run: true
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 'Say "do something" if released'
if: steps.release.outputs.released == 'true'
#language=bash
run: |
echo "do something"
Note: In dry-run mode, no summary will be printed, even if
write-summary
is set totrue
.
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | token |
GitHub Personal access token | ${{ secrets.GITHUB_TOKEN }} |
– |
No | write-summary |
Write a summary to the GitHub action output | false |
true |
No | dry-run |
Run semantic release in dry-run mode | true |
false |
No | semantic-release-args |
Additional semantic release arguments | --debug |
– |
No | working-directory |
Directory to run semantic release in | ./packages/my-package |
– |
Name | Description | Example |
---|---|---|
version |
The version that was just released, prefixed with "v" | v1.2.3 |
previous-version |
The version before the release, prefixed with "v" | v1.2.2 |
version-number |
The version number that was just released | 1.2.3 |
previous-version-number |
The version number before the release | 1.2.2 |
release-type |
The type of the new release. Can be "major", "minor", "patch" or "none" | patch |
released |
Whether a new version was released | true |
- uses: myparcelnl/actions/yarn-install@v4
- uses: myparcelnl/actions/semantic-release@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
write-summary: false
semantic-release-args: --branches=my-branch
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: echo ${{ steps.release.outputs.version }}
Check if there are refs between two refs. Compares the last tag to HEAD by default. Returns true
if there are refs between the two, false
otherwise.
This can be used to check if a new release needs to be done, for example.
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: myparcelnl/actions/has-refs-between@v4
with:
ref-a: 'v2.0.0'
ref-b: 'main'
Required | Name | Description | Example | Default |
---|---|---|---|---|
false | ref-a |
The first ref | v2.0.0 |
last-tag (resolved to last tag) |
false | ref-b |
The second ref | main |
HEAD |
Name | Description | Example |
---|---|---|
has-refs |
Whether there are refs between ref A and B | true or false |
Set up git credentials and authenticate as a GitHub app.
- uses: myparcelnl/actions/setup-git-credentials@v4
with:
app-id: ${{ secrets.GITHUB_APP_ID }}
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
Required | Name | Description | Example | Default |
---|---|---|---|---|
true | app-id |
The app ID of the app. | ${{ secrets.APP_ID }} |
– |
true | private-key |
The private key of the app. | ${{ secrets.APP_PRIVATE_KEY }} |
– |
Name | Description | Example |
---|---|---|
name |
The name of the app. | my-app |
token |
The GitHub token of the app. | ghp_1234567890 |
git-name |
The name to use with git. | my-app[bot] |
git-email |
The email to use with git. | my-app[bot]@users.noreply.github.com |
Rebase two branches and push.
This action uses the App inputs, as well as the following:
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | target |
Target branch you wish to update. | develop |
– |
Yes | base |
Base branch to use to rebase target. | main |
– |
No | force |
Force push. | true |
false |
No | remote |
The remote to use | upstream |
origin |
No | continue-on-error |
Continue when rebasing fails | false |
true |
- uses: myparcelnl/actions/rebase@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: main
target: develop
force: true
remote: upstream
continue-on-error: false
Update git tags to keep major and minor version in sync. Good for releasing GitHub actions.
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | minor |
Update the major version. | true |
true |
No | major |
Update the minor version. | true |
false |
- uses: myparcelnl/actions/update-tags@v4
with:
minor: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
This takes the tag on the current commit, for example v2.3.1
after
running semantic-release, and parses it to determine which tags should be
updated.
If run with minor: true
:
- Will add
v2
to the current commit - Will add
v2.3
to the current commit
If run without minor: true
, or with minor: false
:
- Will add
v2
to the current commit.
Check if there are new commits in head that are not in base.
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | base |
The base branch to compare against | main |
main |
No | head |
The branch to check for new commits | feat/my-feature |
develop |
No | remote |
The remote to use | upstream |
origin |
Name | Description | Example |
---|---|---|
diff |
Whether the branches are different | true |
commits |
List of commits in head that are not in base | • fix: fix a bug (3 days ago) |
compare-url |
Link to the compare view of both commits | https://github.com/myparcelnl/woocommerce/compare/main..develop |
Find an artifact in a repository. Returns the ID of the artifact if it exists.
- uses: myparcelnl/actions/find-artifact@v4
id: artifact
with:
artifact-name: my-artifact
repository: myparcelnl/actions
per-page: 10
max-age: 12 # hours
This action uses the App inputs, as well as the following:
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | artifact-name |
The name of the artifact to check for. | my-artifact |
– |
No | repository |
The repository to check for the artifact in. | myparcelnl/actions |
${{ github.repository }} |
No | per-page |
The number of artifacts to fetch per page. | 20 |
20 |
No | max-age |
The maximum age of the artifact in hours. | 24 |
24 |
Name | Description | Example |
---|---|---|
id |
The ID of the artifact, if it exists. | 1234 |
exists |
Whether the artifact exists in the repository. | true |
Gets a GitHub token to use in the workflow. If token
is passed, it will be used. Otherwise, an app token will be
generated. Either token
or app-id
and private-key
must be passed.
Meant for use within other actions, because obviously you could just use the token
input directly.
- uses: myparcelnl/actions/get-github-token@v4
id: passed-token
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: myparcelnl/actions/get-github-token@v4
id: generated-token
with:
app-id: ${{ secrets.GITHUB_APP_ID }}
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
- run: echo ${{ steps.passed-token.outputs.token }} # The GitHub token that was passed in.
- run: echo ${{ steps.generated-token.outputs.token }} # The GitHub token that was generated.
This action uses the App inputs.
Name | Description | Example |
---|---|---|
token |
The GitHub token. | *** |
Assign the author of a pull request to the pull request. For use with the pull_request
event.
- uses: myparcelnl/actions/pr-assign-author@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Or, if you want to use a GitHub app:
- uses: myparcelnl/actions/pr-assign-author@v4
with:
app-id: ${{ secrets.GITHUB_APP_ID }}
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
See App inputs
Label a pull request based on the review state. For use with the pull_request_review
event.
- Gets the amount of reviews needed.
- Uses
inputs.reviews-required
if passed. - If this input does not exist, the action will get the data via branch protections. You'll need an app or access
token with the
read settings
permission for this.
- Calculates whether the PR is approved or changes are requested.
- Labels the PR accordingly, removing labels that are no longer relevant.
- If the PR is approved:
inputs.label-approved
is added,inputs.label-changes-requested
is removed if it exists. - If changes are requested:
inputs.label-changes-requested
is added,inputs.label-approved
is removed if it exists. - If the PR is not approved and no changes are requested:
inputs.label-approved
andinputs.label-changes-requested
are removed if they exist.
- uses: myparcelnl/actions/pr-label-by-review@v4
with:
# Either a GitHub token or a GitHub app is required.
token: ${{ secrets.GITHUB_TOKEN }}
# Omit `token` and pass the following if you want to use a GitHub app:
app-id: ${{ secrets.GITHUB_APP_ID }}
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
label-approved: 'yay' # The label to add when the PR is approved.
label-changes-requested: 'nay' # The label to add when changes are requested.
required-approvals: 2 # The number of reviews required to merge the PR. Should be passed only if you don't have an access token or app with the read settings permission.
branch-protections: 'rulesets' # Whether to use branch protection or rulesets to determine the number of required reviews.
This action uses the App inputs, as well as the following:
Required | Name | Description | Example | Default |
---|---|---|---|---|
false | required-approvals |
The number of reviews required to merge the PR. Can be passed if you don't have an access token or app with the read settings permission. | 2 |
– |
false | label-approved |
The label to add when the PR is approved. | ready to merge |
approved |
false | label-changes-requested |
The label to add when changes are requested. | needs work |
changes requested |
false | branch-protection |
Whether to use branch protection or rulesets to determine the number of required reviews. | rulesets |
branch-protection |
Post an artifact to a pull request. For use with the workflow_run
event with completed
type. Shows either success with link to artifact or failure depending on the outcome of the workflow.
Requires the referenced workflow to have produced an artifact using the actions/upload-artifact
action.
name: 'Post PR Artifacts'
on:
workflow_run:
types:
- completed
workflows:
- 'My PR Workflow' # The name of the workflow that produces the artifact
jobs:
comment-success:
runs-on: ubuntu-22.04
steps:
- uses: myparcelnl/actions/pr-post-artifacts@v4
with:
app-id: ${{ secrets.GITHUB_APP_ID }}
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
Required | Name | Description | Example | Default |
---|---|---|---|---|
false | app-id |
The app ID of the app. | ${{ secrets.APP_ID }} |
– |
false | private-key |
The private key of the app. | ${{ secrets.APP_PRIVATE_KEY }} |
– |
Validate the title of a pull request based on the conventional commit format. For use with the pull_request
event.
- uses: myparcelnl/actions/pr-validate-title-conventional@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Or, if you want to use a GitHub app:
- uses: myparcelnl/actions/pr-validate-title-conventional@v4
with:
app-id: ${{ secrets.GITHUB_APP_ID }}
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
This action uses the App inputs.
Name | Description | Example |
---|---|---|
success |
Whether the PR title is valid. | true |
error |
Error in case the PR title is not valid. | (string containing the error) |
Wraps peter-evans/rebase
with the ability to use a GitHub app easily.
- Uses [get-github-token] to get a token.
- Passes the token and other inputs to
peter-evans/rebase
. - Sets
${{ github.repository_owner }}:*
as a default value for thehead
input to ignore forks.
This action uses the App inputs, as well as the inputs from the original action.
Wraps peter-evans/repository-dispatch
with the ability to use a GitHub app easily.
Usage is the same as the original action, but with the addition of the app-id
and private-key
inputs.
- Uses [get-github-token] to get a token.
- Passes the token and other inputs to
peter-evans/repository-dispatch
.
This action uses the App inputs, as well as the inputs from the original action.
Mark issues and pull requests as stale after a period of inactivity. For use with the schedule
event.
- uses: myparcelnl/actions/stale@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 30
days-before-pr-stale: 30
This action uses the App inputs, as well as the following:
Required | Name | Description | Example | Default |
---|---|---|---|---|
false | days-before-stale |
Amount of days before an issue is marked as stale. | 14 |
60 |
false | days-before-issue-stale |
Amount of days before an issue is marked as stale. | 14 |
– (inherit) |
false | days-before-pr-stale |
Amount of days before a pull request is marked as stale. | 30 |
– (inherit) |
false | days-before-issue-close |
Amount of days before an issue is closed. | 7 |
14 |
false | days-before-pr-close |
Amount of days before a pull request is closed. | 14 |
-1 (never) |
Name | Description | Example |
---|---|---|
staled-issues-prs |
List of all staled issues and pull requests. | [#1, #2, #3] |
closed-issues-prs |
List of all closed issues and pull requests. | [#1, #2, #3] |
Toggle a label on a pull request on or off based on a boolean input, or automatically if toggle
is omitted. For use
with the pull_request
event.
- uses: myparcelnl/actions/toggle-label@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
label: 'failing tests'
toggle: ${{ steps.tests.outputs.failed }}
This action uses the App inputs, as well as the following:
Required | Name | Description | Example | Default |
---|---|---|---|---|
true | label |
The label to toggle. | failing tests |
– |
true | toggle |
Whether to toggle the label on or off. | true |
auto |
Create or update a comment on an issue or pull request.
- uses: myparcelnl/actions/create-or-update-comment@v4
with:
app-id: ${{ secrets.GITHUB_APP_ID }}
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
identifier: 'my-unique-id'
body: |-
This is a comment.
It can be multiline.
issue-number: 123
# When omitted, comment-id will be searched for based on the identifier.
comment-id: 123456789
This action uses the App inputs (without token
), as well as the following:
Required | Name | Description | Example | Default |
---|---|---|---|---|
true | body |
The body of the comment. | failing tests |
– |
false | identifier |
Hidden identifier to update the comment. | my-unique-id |
– |
false | issue-number |
The issue number to comment on. | 123 |
– |
false | comment-id |
The comment ID to update. | 123456789 |
– |
Name | Description | Example |
---|---|---|
comment-id |
The ID of the comment that was created or updated | 572389429 |
Save and restore the Nx cache.
- Runs [actions/cache] and caches
./.nx/cache
(default)
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | cache-directory |
The nx cache directory | ./path/to/nx/cache |
.nx/cache |
No | max-cache-size |
Maximum size of the nx cache in KB | 4096 |
8192 |
Run nx run
with the provided arguments.
- Runs [nx-cache]
- Runs
<prefix> nx run <target> <args>
.
- uses: myparcelnl/actions/nx-run@v4
with:
target: 'my-project:build'
prefix: 'yarn'
cloud: true
runner: 'cloud'
args: '--exclude=some-project'
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | target |
The target to run. | my-project:build |
- |
No | prefix |
The prefix to use with nx . |
yarn |
npx |
No | args |
Arguments to pass to the command. | --runner=cloud |
- |
No | cache-directory |
The nx cache directory | ./path/to/nx/cache |
.nx/cache |
No | max-cache-size |
Maximum size of the nx cache in KB | 4096 |
8192 |
No | cloud |
Whether this will run using nx cloud | true |
false |
No | command |
The command to run | run-many |
run |
No | runner |
The runner to use | cloud |
- |
Run nx run-many
with the provided arguments.
- Runs [nx-cache]
- Runs
<prefix> nx run-many <args> --target=<target>
.
- uses: myparcelnl/actions/nx-run-many@v4
with:
target: 'build'
prefix: 'yarn'
cloud: true
runner: 'cloud'
args: '--exclude=some-project'
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | target |
The target to run. | build |
- |
No | prefix |
The prefix to use with nx . |
yarn |
npx |
No | args |
Arguments to pass to the command. | --all --runner=cloud |
- |
No | cache-directory |
The nx cache directory | ./path/to/nx/cache |
.nx/cache |
No | max-cache-size |
Maximum size of the nx cache in KB | 4096 |
8192 |
No | cloud |
Whether this will run using nx cloud | true |
false |
No | command |
The command to run | run-many |
run |
No | runner |
The runner to use | cloud |
- |
No | parallel |
How many commands can run in parallel | 1 |
- |
Setup Bun and install dependencies.
- Runs oven-sh/setup-bun
- Caches bun cache folder
- Installs dependencies with
bun install <bun-args>
- uses: myparcelnl/actions/bun-install@v4
with:
bun-version: 1.0.0
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | bun-version |
The Bun version to install | latest |
1.0.0 |
No | bun-args |
Arguments to pass to bun install | --no-progress |
--frozen-lockfile |
Run BundleWatch to check the size of your bundles. You will need to provide a [BundleWatch token] and a configuration.
If you don't pass the config
input, it will look for the bundlewatch
key in your package.json
.
- uses: myparcelnl/actions/bundlewatch@v4
with:
config: .bundlewatch.json
token: ${{ secrets.BUNDLEWATCH_TOKEN }}
Required | Name | Description | Example | Default |
---|---|---|---|---|
No | config | Path to the BundleWatch config file. | .bundlewatch.json |
– |
Yes | token | BundleWatch token to use. | ${{ secrets.BUNDLEWATCH_TOKEN }} |
– |
Create cache keys for use with [actions/cache].
- uses: myparcelnl/actions/create-cache-keys@v4
id: keys
with:
key: '${{ runner.os }}-composer'
input: |
7.4
${{ hashFiles('composer.json', 'composer.lock') }}
- uses: actions/cache@v4
with:
path: some-path
key: ${{ steps.keys.outputs.key }} # Linux-composer-7.4-<hash>
restore-keys: ${{ steps.keys.outputs.restore-keys }} # Linux-composer-7.4-, Linux-composer- (as multiline string)
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | key |
The base key for the cache | composer |
– |
No | input |
Input list to use for generating the cache key | 7.4 |
'' |
No | restore-keys |
Number of restore keys. Set to 0 to disable restore keys | 2 |
auto |
Name | Description | Example |
---|---|---|
cache-key |
The generated cache key | composer-7.4-1234567890-bla |
restore-keys |
The generated restore keys | composer-7.4-1234567890-\ncomposer-7.4- |
Mark something as deprecated. This will add a warning to the workflow run.
- uses: myparcelnl/actions/deprecated@v4
with:
name: 'my-name/my-action'
replacement: 'my-name/my-new-action'
reason: 'It is no longer maintained.'
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | name |
Name of the thing to mark as deprecated | my-name/my-action |
– |
No | replacement |
The replacement | my-name/my-new-action |
– |
No | reason |
The reason why it is deprecated | It is no longer maintained. |
– |
Format a string. Input should be a string separated by the input-separator
. If input string is empty, an empty string will be returned. Lines can be sorted and deduplicated. The string that is formatted will be output as string
.
- uses: myparcelnl/actions/format-string@v4
id: format
with:
string: |
no longer
string
a
multiline
input-separator: '\n'
output-separator: ' '
deduplicate: true
sort: true
- run: echo ${{ steps.format.outputs.string }} // a multiline no longer string
Mode: args
- uses: myparcelnl/actions/format-string@v4
id: format
with:
mode: 'args'
string: |
--arg2=value1
--arg1
--verbose
--arg2=override
input-separator: '\n'
output-separator: ' '
deduplicate: true
sort: true
- run: echo ${{ steps.format.outputs.string }} // --arg1 --arg2=override --verbose
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | string |
The string to format. Can be empty or multiple lines. | my string |
– |
No | input-separator |
The separator to use when splitting input to multiple lines. | ' ' |
'\n' |
No | output-separator |
The separator to use for the generated output string. | ',' |
' ' |
No | deduplicate |
Whether to deduplicate the lines before joining. Always done if mode is "args". | true |
false |
No | sort |
Whether to sort the lines before joining. | true |
false |
No | mode |
The mode to use for formatting. Set to "args" to deduplicate key-value pairs. | args |
– |
Name | Description | Example |
---|---|---|
string |
The formatted string. | `my string to hash' |
Hash a string. Input should be a string separated by the input-separator
. If input string is empty, an empty string will be returned. If input string contains multiple lines (according to the separator) the lines will be sorted, deduplicated and hashed. The string that is hashed will be output as string
.
- uses: myparcelnl/actions/hash-string@v4
id: hash
with:
method: 'sha256sum'
separator: '\n' # default value
string: |
my
multiline
string
- run: echo ${{ steps.hash.outputs.string }} // multiline my string
- run: echo ${{ steps.hash.outputs.hash }} // bdfe7443bc0ddf3fb21a2c407e876458d04a5931b16259cbd727f7fd6ac4ef3b
Required | Name | Description | Example | Default |
---|---|---|---|---|
Yes | string |
The string to hash. Can be empty or multiple lines. | my string |
– |
No | separator |
The separator to use when splitting input to multiple lines. | ' ' |
'\n' |
No | method |
The hashing method to use. | sha256sum |
md5sum |
No | mode |
The mode to use for formatting. Set to "args" to deduplicate key-value pairs. | args |
– |
Name | Description | Example |
---|---|---|
hash |
The hashed string, empty if no string was provided. | c403c22aac54783366d90df0bbdadc1a |
string |
The string that was hashed. | `my string to hash' |
Many of these actions can use either a GitHub token or a GitHub app. If you want to use a GitHub app, you can pass the app-id
and private-key
inputs. The app will then be used to authenticate with GitHub.
These inputs apply on top of the other inputs of the action that allows for GitHub app authentication.
Required | Name | Description | Example | Default |
---|---|---|---|---|
false | token |
GitHub token to use. If passed, takes precedence over the app-id and app-private-key inputs. |
${{ secrets.GITHUB_TOKEN }} |
– |
false | app-id |
The app ID of the app. | ${{ secrets.APP_ID }} |
– |
false | private-key |
The private key of the app. | ${{ secrets.APP_PRIVATE_KEY }} |
– |