Get diff data from PR. This action will return commit messages, associated issues parsed frm commit messages, diff patches and raw final files changed or created by PR.
-
π οΈ Install the dependencies
npm install
-
ποΈ Package the TypeScript for distribution
npm run bundle
-
β Run the tests
npm test
-
(Optional) Test your action locally
The
@github/local-action
utility can be used to test your action locally. It is a simple command-line tool that "stubs" (or simulates) the GitHub Actions Toolkit. This way, you can run your TypeScript action locally without having to commit and push your changes to a repository.The
local-action
utility can be run in the following ways:-
Visual Studio Code Debugger
Make sure to review and, if needed, update
.vscode/launch.json
-
Terminal/Command Prompt
# npx @github/local action <action-yaml-path> <entrypoint> <dotenv-file> npx @github/local-action . src/main.ts .env
You can provide a
.env
file to thelocal-action
CLI to set environment variables used by the GitHub Actions Toolkit. For example, setting inputs and event payload data used by your action. For more information, see the example file,.env.example
, and the GitHub Actions Documentation. -
Your action is now published! π
You can now validate the action by referencing it in a workflow file. For example,
ci.yml
demonstrates how to reference an action in the same repository.
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Test Local Action
id: test-action
uses: ./
with: ...
For example workflow runs, check out the Actions tab! π
After testing, you can create version tag(s) that developers can use to reference different stable versions of your action. For more information, see Versioning in the GitHub Actions toolkit.
To include the action in a workflow in another repository, you can use the uses
syntax with the @
symbol to
reference a specific branch, tag, or commit hash.
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Test Local Action
id: test-action
uses: actions/typescript-action@v1 # Commit with the `v1` tag
with: ...
This project includes a helper script, script/release
designed to streamline the process of
tagging and pushing new releases for GitHub Actions.
GitHub Actions allows users to select a specific version of the action to use, based on release tags. This script simplifies this process by performing the following steps:
- Retrieving the latest release tag: The script starts by fetching the most recent SemVer release tag of the current branch, by looking at the local data available in your repository.
- Prompting for a new release tag: The user is then prompted to enter a new release tag. To assist with this, the script displays the tag retrieved in the previous step, and validates the format of the inputted tag (vX.X.X). The user is also reminded to update the version field in package.json.
- Tagging the new release: The script then tags a new release and syncs the separate major tag (e.g. v1, v2) with
the new release tag (e.g. v1.0.0, v2.1.2). When the user is creating a new major release, the script auto-detects
this and creates a
releases/v#
branch for the previous major version. - Pushing changes to remote: Finally, the script pushes the necessary commits, tags and branches to the remote repository. From here, you will need to create a new release in GitHub so users can easily reference the new tags in their workflows.