Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
crazywhalecc committed Oct 8, 2024
1 parent 92ebc74 commit d00662c
Showing 1 changed file with 38 additions and 41 deletions.
79 changes: 38 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

Use this template to bootstrap the creation of a JavaScript action. :rocket:

This template includes compilation support, tests, a validation workflow,
publishing, and versioning guidance.
This template includes compilation support, tests, a validation workflow, publishing, and versioning
guidance.

If you are new, there's also a simpler introduction in the
[Hello world JavaScript action repository](https://github.com/actions/hello-world-javascript-action).

## Create Your Own Action

To create your own action, you can use this repository as a template! Just
follow the below instructions:
To create your own action, you can use this repository as a template! Just follow the below
instructions:

1. Click the **Use this template** button at the top of the repository
1. Select **Create a new repository**
Expand All @@ -24,23 +24,22 @@ follow the below instructions:

> [!IMPORTANT]
>
> Make sure to remove or update the [`CODEOWNERS`](./CODEOWNERS) file! For
> details on how to use this file, see
> Make sure to remove or update the [`CODEOWNERS`](./CODEOWNERS) file! For details on how to use
> this file, see
> [About code owners](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners).
## Initial Setup

After you've cloned the repository to your local machine or codespace, you'll
need to perform some initial setup steps before you can develop your action.
After you've cloned the repository to your local machine or codespace, you'll need to perform some
initial setup steps before you can develop your action.

> [!NOTE]
>
> You'll need to have a reasonably modern version of
> [Node.js](https://nodejs.org) handy. If you are using a version manager like
> [`nodenv`](https://github.com/nodenv/nodenv) or
> [`nvm`](https://github.com/nvm-sh/nvm), you can run `nodenv install` in the
> root of your repository to install the version specified in
> [`package.json`](./package.json). Otherwise, 20.x or later should work!
> You'll need to have a reasonably modern version of [Node.js](https://nodejs.org) handy. If you are
> using a version manager like [`nodenv`](https://github.com/nodenv/nodenv) or
> [`nvm`](https://github.com/nvm-sh/nvm), you can run `nodenv install` in the root of your
> repository to install the version specified in [`package.json`](./package.json). Otherwise, 20.x
> or later should work!
1. :hammer_and_wrench: Install the dependencies

Expand Down Expand Up @@ -69,23 +68,23 @@ need to perform some initial setup steps before you can develop your action.

## Update the Action Metadata

The [`action.yml`](action.yml) file defines metadata about your action, such as
input(s) and output(s). For details about this file, see
The [`action.yml`](action.yml) file defines metadata about your action, such as input(s) and
output(s). For details about this file, see
[Metadata syntax for GitHub Actions](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions).

When you copy this repository, update `action.yml` with the name, description,
inputs, and outputs for your action.
When you copy this repository, update `action.yml` with the name, description, inputs, and outputs
for your action.

## Update the Action Code

The [`src/`](./src/) directory is the heart of your action! This contains the
source code that will be run when your action is invoked. You can replace the
contents of this directory with your own code.
The [`src/`](./src/) directory is the heart of your action! This contains the source code that will
be run when your action is invoked. You can replace the contents of this directory with your own
code.

There are a few things to keep in mind when writing your action code:

- Most GitHub Actions toolkit and CI/CD operations are processed asynchronously.
In `main.js`, you will see that the action is run in an `async` function.
- Most GitHub Actions toolkit and CI/CD operations are processed asynchronously. In `main.js`, you
will see that the action is run in an `async` function.

```javascript
const core = require('@actions/core');
Expand Down Expand Up @@ -121,12 +120,11 @@ So, what are you waiting for? Go ahead and start customizing your action!

> [!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.
> 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

Expand All @@ -147,14 +145,14 @@ So, what are you waiting for? Go ahead and start customizing your action!
Your action is now published! :rocket:

For information about versioning your action, see
[Versioning](https://github.com/actions/toolkit/blob/main/docs/action-versioning.md)
in the GitHub Actions toolkit.
[Versioning](https://github.com/actions/toolkit/blob/main/docs/action-versioning.md) in the GitHub
Actions toolkit.

## Validate the Action

You can now validate the action by referencing it in a workflow file. For
example, [`ci.yml`](./.github/workflows/ci.yml) demonstrates how to reference an
action in the same repository.
You can now validate the action by referencing it in a workflow file. For example,
[`ci.yml`](./.github/workflows/ci.yml) demonstrates how to reference an action in the same
repository.

```yaml
steps:
Expand All @@ -178,14 +176,13 @@ For example workflow runs, check out the
## Usage
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](https://github.com/actions/toolkit/blob/main/docs/action-versioning.md)
in the GitHub Actions toolkit.
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](https://github.com/actions/toolkit/blob/main/docs/action-versioning.md) 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.
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.

```yaml
steps:
Expand Down

0 comments on commit d00662c

Please sign in to comment.