generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
36,067 additions
and
1,285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,6 @@ MD004: | |
# Ordered list item prefix | ||
MD029: | ||
style: one | ||
|
||
MD013: | ||
line_length: 250 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Contributing | ||
|
||
## Setup | ||
|
||
> [!NOTE] | ||
> | ||
> You'll need to have a reasonably modern version of | ||
> [Node.js](https://nodejs.org) handy (20.x or later should work!). If you are | ||
> using a version manager like [`nodenv`](https://github.com/nodenv/nodenv) or | ||
> [`nvm`](https://github.com/nvm-sh/nvm), this template has a `.node-version` | ||
> file at the root of the repository that will be used to automatically switch | ||
> to the correct version when you `cd` into the repository. Additionally, this | ||
> `.node-version` file is used by GitHub Actions in any `actions/setup-node` | ||
> actions. | ||
1. :hammer_and_wrench: Install the dependencies | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
1. :building_construction: Package the TypeScript for distribution | ||
|
||
```bash | ||
npm run bundle | ||
``` | ||
|
||
1. :white_check_mark: Run the tests | ||
|
||
```bash | ||
$ npm test | ||
|
||
PASS ./index.test.js | ||
✓ throws invalid number (3ms) | ||
✓ wait 500 ms (504ms) | ||
✓ test runs (95ms) | ||
|
||
... | ||
``` | ||
|
||
## Development | ||
|
||
1. Create a new branch | ||
|
||
```bash | ||
git checkout -b releases/v1 | ||
``` | ||
|
||
1. Replace the contents of `src/` with your action code | ||
1. Add tests to `__tests__/` for your source code | ||
1. Format, test, and build the action | ||
|
||
```bash | ||
npm run all | ||
``` | ||
|
||
> [!WARNING] | ||
> | ||
> This step is important! It will run [`ncc`](https://github.com/vercel/ncc) | ||
> to build the final JavaScript action code with all dependencies included. | ||
> If you do not run this step, your action will not work correctly when it is | ||
> used in a workflow. This step also includes the `--license` option for | ||
> `ncc`, which will create a license file for all of the production node | ||
> modules used in your project. | ||
1. Commit your changes | ||
|
||
```bash | ||
git add . | ||
git commit -m "My first action is ready!" | ||
``` | ||
|
||
1. Push them to your repository | ||
|
||
```bash | ||
git push -u origin releases/v1 | ||
``` | ||
|
||
1. Create a pull request and get feedback on your action | ||
1. Merge the pull request into the `main` branch | ||
1. The [`test-action`](./github/workflows/ci.yml) check in CI will do a basic | ||
check on the action | ||
|
||
## Publishing a new release | ||
|
||
This project includes a helper script (`./script/release`) designed to | ||
streamline the process of tagging and pushing new releases for GitHub Actions. | ||
|
||
It performs the following steps: | ||
|
||
1. **Retrieving the latest release tag:** The script starts by fetching the most | ||
recent release tag by looking at the local data available in your repository. | ||
1. **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 latest release tag | ||
and provides a regular expression to validate the format of the new tag. | ||
1. **Tagging the new release:** Once a valid new tag is entered, the script tags | ||
the new release. | ||
1. **Pushing the new tag to the remote:** Finally, the script pushes the new tag | ||
to the remote repository. From here, you will need to create a new release in | ||
GitHub and users can easily reference the new tag in their workflows. | ||
|
||
## Resources | ||
|
||
- [Octokit JS docs](https://octokit.github.io/rest.js/v20) | ||
- [GitHub REST API docs](https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28) |
Oops, something went wrong.