A selection of reusable GitHub Actions
The auto-merge
reusable action is located in .github/workflows/auto-merge.yml
. To use it you will need a Personal Access Token with the following scopes:
repo
for private repositoriespublic_repo
for public repositories
In the repository that will call this action, you need to define a secret named GH_TOKEN
with the value of your Personal Access Token.
This reusable action depends on the following actions:
In the repository that will call this action, you will need to define a .github/workflows/auto-merge.yml
file with the following content:
name: auto-merge
on: [pull_request_target]
jobs:
auto-merge:
uses: project-calavera/calavera-reusable-actions/.github/workflows/auto-merge.yml@main
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
The publish-vscode-extension
reusable action is located in .github/workflows/publish-vscode-extension.yml
. To use it you will need a Personal Access Token named VSCODE_MARKETPLACE_TOKEN
.
In the repository that will call this action, you need to define a secret named VSCODE_MARKETPLACE_TOKEN
with the value of your Personal Access Token.
This reusable action depends on the following actions:
In the repository that will call this action, you will need to define a .github/workflows/publish-vscode-extension.yml
file with the following content:
name: publish-vscode-extension
on:
push:
branches:
- main
jobs:
publish-vscode-extension:
uses: project-calavera/calavera-reusable-actions/.github/workflows/publish-vscode-extension.yml@main
secrets:
VSCODE_MARKETPLACE_TOKEN: ${{ secrets.VSCODE_MARKETPLACE_TOKEN }}
The set-default-labels
reusable action is located in .github/workflows/set-default-labels.yml
.
This reusable action depends on the following actions:
In the repository that will call this action, you will need to create the following file: .github/labels.json
. The content of the file can be something like the following:
[
{
"name": "bug",
"color": "#d73a4a",
"description": "something isn’t working"
},
{
"name": "chore",
"color": "#fef2c0",
"description": "keeping the lights on"
}
]
You can find more details about the above on the issue-label-manager-action documentation. The next item you need to create in the repository that will call this action, is a workflow file. You can name the file .github/workflows/set-default-labels.yml
and add the following content:
name: set-default-labels
on: [workflow_dispatch]
jobs:
set-default-labels:
uses: project-calavera/calavera-reusable-actions/.github/workflows/set-default-labels.yml@main
The action has the following inputs:
This is an optional boolean
input that is false
by default. If set to true
, the action will delete any existing labels that are not listed in the JSON file mentioned previously.
name: set-default-labels
on: [workflow_dispatch]
jobs:
set-default-labels:
uses: project-calavera/calavera-reusable-actions/.github/workflows/set-default-labels.yml@main
with:
should-delete-labels: true
Because of the nature of this action, it must be run manually. You can learn more about manually running actions on GitHub.
The publish-release
GitHub Action automates publication of a new release on GitHub, updates the changelog and also publishes to the NPM registry.
NOTE: For the
release-please
workflow to work effectively, you need to follow the conventional commits conventions as detailed here. You can also find additional documentation on the GitHub Actions README.
This reusable action depends on the following actions:
The action has the following inputs:
This is can be one of the release types as detailed in the release please docs.
- This
input
is optional with a default ofnode
The version of Node.js to use for the release. This action supports all active and maintenance releases of Node.js.
- This
input
is optional with a default of12
Whether to publish the package to the NPM registry.
- This
input
is optional with a default oftrue
Arguments to pass to the npm publish
command. This is ignored if npm-publish
is set to false
.
- This
input
is optional with a default of an empty string
The registry to publish to.
- This
input
is optional with a default ofhttps://registry.npmjs.org
This action requires the following secrets to be passed by the caller. Both of these need to be set as environmental secrets using the calling repositories settings.
Personal access token passed from the caller workflow. Read the documentation on creating a PA token.
Authentication token for the NPM registry. Read the documentation for details on creating a token.
NOTE: When skipping NPM publishing, this token is not required.
In the repository that will call this action, you will need to add a .github/workflows/publish-release.yml
file with the following content:
name: publish-release
on:
push:
branches:
- main
jobs:
publish-release:
uses: project-calavera/calavera-reusable-actions/.github/workflows/publish-release.yml@main
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
name: publish-release
on:
push:
branches:
- main
jobs:
publish-release:
uses: project-calavera/calavera-reusable-actions/.github/workflows/publish-release.yml@main
with:
release-type: python
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
name: publish-release
on:
push:
branches:
- main
jobs:
publish-release:
uses: project-calavera/calavera-reusable-actions/.github/workflows/publish-release.yml@main
with:
npm-publish: false
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}