Skip to content

Commit 9df759c

Browse files
authored
Update README.md (#3)
1 parent 6816103 commit 9df759c

File tree

1 file changed

+18
-173
lines changed

1 file changed

+18
-173
lines changed

README.md

+18-173
Original file line numberDiff line numberDiff line change
@@ -1,180 +1,31 @@
1-
# Create a JavaScript Action Using TypeScript
1+
# 📦🦋 Changeset Per Package 🦋📦
22

33
![Test Coverage](badges/coverage.svg)
44
[![GitHub Super-Linter](https://github.com/actions/typescript-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)
55
![CI](https://github.com/actions/typescript-action/actions/workflows/ci.yml/badge.svg)
66

7-
Use this template to bootstrap the creation of a TypeScript action. :rocket:
7+
This action validates that there is a changeset entry for each package that has
8+
been changed.
89

9-
This template includes compilation support, tests, a validation workflow,
10-
publishing, and versioning guidance.
10+
This repository has two action files:
1111

12-
If you are new, there's also a simpler introduction in the
13-
[Hello world JavaScript action repository](https://github.com/actions/hello-world-javascript-action).
12+
| File | Description |
13+
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
14+
| [`./action.yml`](./action.yml) | This composite action calls on other Khan actions to prepare a list of changed files. |
15+
| [`./actions/verify-per-package/action.yml`](./actions/verify-per-package/action.yml) | This ts action contains its logic to [`./src/main.ts`](./src/main.ts). It checks for packages corresponding to changed files, then determines if there is a match for each in changesets. |
1416

15-
## Create Your Own Action
17+
## When Making Changes
1618

17-
To create your own action, you can use this repository as a template! Just
18-
follow the below instructions:
19+
Please run `yarn all` to ensure that it builds and that all tests pass.
1920

20-
1. Click the **Use this template** button at the top of the repository
21-
1. Select **Create a new repository**
22-
1. Select an owner and name for your new repository
23-
1. Click **Create repository**
24-
1. Clone your new repository
25-
26-
## Initial Setup
27-
28-
After you've cloned the repository to your local machine or codespace, you'll
29-
need to perform some initial setup steps before you can develop your action.
30-
31-
> [!NOTE]
32-
>
33-
> You'll need to have a reasonably modern version of
34-
> [Node.js](https://nodejs.org) handy. If you are using a version manager like
35-
> [`nodenv`](https://github.com/nodenv/nodenv) or
36-
> [`nvm`](https://github.com/nvm-sh/nvm), you can run `nodenv install` in the
37-
> root of your repository to install the version specified in
38-
> [`package.json`](./package.json). Otherwise, 20.x or later should work!
39-
40-
1. :hammer_and_wrench: Install the dependencies
41-
42-
```bash
43-
npm install
44-
```
45-
46-
1. :building_construction: Package the TypeScript for distribution
47-
48-
```bash
49-
npm run bundle
50-
```
51-
52-
1. :white_check_mark: Run the tests
53-
54-
```bash
55-
$ npm test
56-
57-
PASS ./index.test.js
58-
✓ throws invalid number (3ms)
59-
wait 500 ms (504ms)
60-
test runs (95ms)
61-
62-
...
63-
```
64-
65-
## Update the Action Metadata
66-
67-
The [`action.yml`](action.yml) file defines metadata about your action, such as
68-
input(s) and output(s). For details about this file, see
69-
[Metadata syntax for GitHub Actions](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions).
70-
71-
When you copy this repository, update `action.yml` with the name, description,
72-
inputs, and outputs for your action.
73-
74-
## Update the Action Code
75-
76-
The [`src/`](./src/) directory is the heart of your action! This contains the
77-
source code that will be run when your action is invoked. You can replace the
78-
contents of this directory with your own code.
79-
80-
There are a few things to keep in mind when writing your action code:
81-
82-
- Most GitHub Actions toolkit and CI/CD operations are processed asynchronously.
83-
In `main.ts`, you will see that the action is run in an `async` function.
84-
85-
```javascript
86-
import * as core from '@actions/core'
87-
//...
88-
89-
async function run() {
90-
try {
91-
//...
92-
} catch (error) {
93-
core.setFailed(error.message)
94-
}
95-
}
96-
```
97-
98-
For more information about the GitHub Actions toolkit, see the
99-
[documentation](https://github.com/actions/toolkit/blob/master/README.md).
100-
101-
So, what are you waiting for? Go ahead and start customizing your action!
102-
103-
1. Create a new branch
104-
105-
```bash
106-
git checkout -b releases/v1
107-
```
108-
109-
1. Replace the contents of `src/` with your action code
110-
1. Add tests to `__tests__/` for your source code
111-
1. Format, test, and build the action
112-
113-
```bash
114-
npm run all
115-
```
116-
117-
> [!WARNING]
118-
>
119-
> This step is important! It will run [`ncc`](https://github.com/vercel/ncc)
120-
> to build the final JavaScript action code with all dependencies included.
121-
> If you do not run this step, your action will not work correctly when it is
122-
> used in a workflow. This step also includes the `--license` option for
123-
> `ncc`, which will create a license file for all of the production node
124-
> modules used in your project.
125-
126-
1. Commit your changes
127-
128-
```bash
129-
git add .
130-
git commit -m "My first action is ready!"
131-
```
132-
133-
1. Push them to your repository
134-
135-
```bash
136-
git push -u origin releases/v1
137-
```
138-
139-
1. Create a pull request and get feedback on your action
140-
1. Merge the pull request into the `main` branch
141-
142-
Your action is now published! :rocket:
143-
144-
For information about versioning your action, see
145-
[Versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
146-
in the GitHub Actions toolkit.
147-
148-
## Validate the Action
149-
150-
You can now validate the action by referencing it in a workflow file. For
151-
example, [`ci.yml`](./.github/workflows/ci.yml) demonstrates how to reference an
152-
action in the same repository.
153-
154-
```yaml
155-
steps:
156-
- name: Checkout
157-
id: checkout
158-
uses: actions/checkout@v3
159-
160-
- name: Test Local Action
161-
id: test-action
162-
uses: ./
163-
with:
164-
milliseconds: 1000
165-
166-
- name: Print Output
167-
id: output
168-
run: echo "${{ steps.test-action.outputs.time }}"
169-
```
170-
171-
For example workflow runs, check out the
172-
[Actions tab](https://github.com/actions/typescript-action/actions)! :rocket:
21+
This action is dogfooded in the workflow for this repo. See
22+
[`ci.yml`](./.github/workflows/ci.yml). That way, you can test the behavior of
23+
your changes by opening a PR.
17324

17425
## Usage
17526

176-
After testing, you can create version tag(s) that developers can use to
177-
reference different stable versions of your action. For more information, see
27+
You can create version tag(s) that developers can use to reference different
28+
stable versions of your action. For more information, see
17829
[Versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
17930
in the GitHub Actions toolkit.
18031

@@ -188,13 +39,7 @@ steps:
18839
id: checkout
18940
uses: actions/checkout@v3
19041

191-
- name: Test Local Action
192-
id: test-action
193-
uses: actions/typescript-action@v1 # Commit with the `v1` tag
194-
with:
195-
milliseconds: 1000
196-
197-
- name: Print Output
198-
id: output
199-
run: echo "${{ steps.test-action.outputs.time }}"
42+
- name: Verify Changeset Per Package
43+
id: changeset-per-package
44+
uses: Khan/changeset-per-package@v1 # Commit with the `v1` tag
20045
```

0 commit comments

Comments
 (0)