Skip to content

Commit 294a5b0

Browse files
committed
fix: lint format error for node version
1 parent acbe709 commit 294a5b0

1 file changed

Lines changed: 4 additions & 273 deletions

File tree

README.md

Lines changed: 4 additions & 273 deletions
Original file line numberDiff line numberDiff line change
@@ -140,281 +140,22 @@ jobs:
140140

141141
### Environment Setup
142142

143-
1. Install dependencies:
144-
145-
```bash
146-
npm install
147-
```
148-
149-
2. Make sure you have Node.js 20.x or later installed
150-
151-
### Building
152-
153-
Package the TypeScript for distribution:
154-
155-
```bash
156-
npm run bundle
157-
```
158-
159-
```bash
160-
$ npm test
161-
162-
PASS ./index.test.js
163-
✓ throws invalid number (3ms)
164-
✓ wait 500 ms (504ms)
165-
✓ test runs (95ms)
166-
167-
...
168-
```
169-
170-
## Update the Action Metadata
171-
172-
The [`action.yml`](action.yml) file defines metadata about your action, such as
173-
input(s) and output(s). For details about this file, see
174-
[Metadata syntax for GitHub Actions](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions).
175-
176-
When you copy this repository, update `action.yml` with the name, description,
177-
inputs, and outputs for your action.
178-
179-
## Update the Action Code
180-
181-
The [`src/`](./src/) directory is the heart of your action! This contains the
182-
source code that will be run when your action is invoked. You can replace the
183-
contents of this directory with your own code.
184-
185-
There are a few things to keep in mind when writing your action code:
186-
187-
- Most GitHub Actions toolkit and CI/CD operations are processed asynchronously.
188-
In `main.ts`, you will see that the action is run in an `async` function.
189-
190-
```javascript
191-
import * as core from '@actions/core'
192-
//...
193-
194-
async function run() {
195-
try {
196-
//...
197-
} catch (error) {
198-
core.setFailed(error.message)
199-
}
200-
}
201-
```
202-
203-
For more information about the GitHub Actions toolkit, see the
204-
[documentation](https://github.com/actions/toolkit/blob/main/README.md).
205-
206-
So, what are you waiting for? Go ahead and start customizing your action!
207-
208-
1. Create a new branch
209-
210-
```bash
211-
git checkout -b releases/v1
212-
```
213-
214-
1. Replace the contents of `src/` with your action code
215-
1. Add tests to `__tests__/` for your source code
216-
1. Format, test, and build the action
217-
218-
```bash
219-
npm run all
220-
```
221-
222-
> This step is important! It will run [`rollup`](https://rollupjs.org/) to
223-
> build the final JavaScript action code with all dependencies included. If
224-
> you do not run this step, your action will not work correctly when it is
225-
> used in a workflow.
226-
227-
1. (Optional) Test your action locally
228-
229-
The [`@github/local-action`](https://github.com/github/local-action) utility
230-
can be used to test your action locally. It is a simple command-line tool
231-
that "stubs" (or simulates) the GitHub Actions Toolkit. This way, you can run
232-
your TypeScript action locally without having to commit and push your changes
233-
to a repository.
234-
235-
The `local-action` utility can be run in the following ways:
236-
- Visual Studio Code Debugger
237-
238-
Make sure to review and, if needed, update
239-
[`.vscode/launch.json`](./.vscode/launch.json)
240-
241-
- Terminal/Command Prompt
242-
243-
```bash
244-
# npx @github/local action <action-yaml-path> <entrypoint> <dotenv-file>
245-
npx @github/local-action . src/main.ts .env
246-
```
247-
248-
You can provide a `.env` file to the `local-action` CLI to set environment
249-
variables used by the GitHub Actions Toolkit. For example, setting inputs and
250-
event payload data used by your action. For more information, see the example
251-
file, [`.env.example`](./.env.example), and the
252-
[GitHub Actions Documentation](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables).
253-
254-
1. Commit your changes
255-
256-
```bash
257-
git add .
258-
git commit -m "My first action is ready!"
259-
```
260-
261-
1. Push them to your repository
262-
263-
```bash
264-
git push -u origin releases/v1
265-
```
266-
267-
1. Create a pull request and get feedback on your action
268-
1. Merge the pull request into the `main` branch
269-
270-
Your action is now published! :rocket:
271-
272-
For information about versioning your action, see
273-
[Versioning](https://github.com/actions/toolkit/blob/main/docs/action-versioning.md)
274-
in the GitHub Actions toolkit.
275-
276-
## Validate the Action
277-
278-
You can now validate the action by referencing it in a workflow file. For
279-
example, [`ci.yml`](./.github/workflows/ci.yml) demonstrates how to reference an
280-
action in the same repository.
281-
282-
```yaml
283-
steps:
284-
- name: Checkout
285-
id: checkout
286-
uses: actions/checkout@v4
287-
288-
- name: Test Local Action
289-
id: test-action
290-
uses: ./
291-
with:
292-
milliseconds: 1000
293-
294-
- name: Print Output
295-
id: output
296-
run: echo "${{ steps.test-action.outputs.time }}"
297-
```
298-
299-
For example workflow runs, check out the
300-
[Actions tab](https://github.com/actions/typescript-action/actions)! :rocket:
301-
302-
## Usage
303-
304-
After testing, you can create version tag(s) that developers can use to
305-
reference different stable versions of your action. For more information, see
306-
[Versioning](https://github.com/actions/toolkit/blob/main/docs/action-versioning.md)
307-
in the GitHub Actions toolkit.
308-
309-
To include the action in a workflow in another repository, you can use the
310-
`uses` syntax with the `@` symbol to reference a specific branch, tag, or commit
311-
hash.
312-
313-
```yaml
314-
steps:
315-
- name: Checkout
316-
id: checkout
317-
uses: actions/checkout@v4
318-
319-
- name: Test Local Action
320-
id: test-action
321-
uses: actions/typescript-action@v1 # Commit with the `v1` tag
322-
with:
323-
milliseconds: 1000
324-
325-
- name: Print Output
326-
id: output
327-
run: echo "${{ steps.test-action.outputs.time }}"
328-
```
329-
330-
## Publishing a New Release
331-
332-
This project includes a helper script, [`script/release`](./script/release)
333-
designed to streamline the process of tagging and pushing new releases for
334-
GitHub Actions.
335-
336-
GitHub Actions allows users to select a specific version of the action to use,
337-
based on release tags. This script simplifies this process by performing the
338-
following steps:
339-
340-
1. **Retrieving the latest release tag:** The script starts by fetching the most
341-
recent SemVer release tag of the current branch, by looking at the local data
342-
available in your repository.
343-
1. **Prompting for a new release tag:** The user is then prompted to enter a new
344-
release tag. To assist with this, the script displays the tag retrieved in
345-
the previous step, and validates the format of the inputted tag (vX.X.X). The
346-
user is also reminded to update the version field in package.json.
347-
1. **Tagging the new release:** The script then tags a new release and syncs the
348-
separate major tag (e.g. v1, v2) with the new release tag (e.g. v1.0.0,
349-
v2.1.2). When the user is creating a new major release, the script
350-
auto-detects this and creates a `releases/v#` branch for the previous major
351-
version.
352-
1. **Pushing changes to remote:** Finally, the script pushes the necessary
353-
commits, tags and branches to the remote repository. From here, you will need
354-
to create a new release in GitHub so users can easily reference the new tags
355-
in their workflows.
356-
357-
## Dependency License Management
358-
359-
This template includes a GitHub Actions workflow,
360-
[`licensed.yml`](./.github/workflows/licensed.yml), that uses
361-
[Licensed](https://github.com/licensee/licensed) to check for dependencies with
362-
missing or non-compliant licenses. This workflow is initially disabled. To
363-
enable the workflow, follow the below steps.
364-
365-
1. Open [`licensed.yml`](./.github/workflows/licensed.yml)
366-
1. Uncomment the following lines:
367-
368-
```yaml
369-
# pull_request:
370-
# branches:
371-
# - main
372-
# push:
373-
# branches:
374-
# - main
375-
```
376-
377-
1. Save and commit the changes
378-
379-
Once complete, this workflow will run any time a pull request is created or
380-
changes pushed directly to `main`. If the workflow detects any dependencies with
381-
missing or non-compliant licenses, it will fail the workflow and provide details
382-
on the issue(s) found.
383-
384-
### Updating Licenses
385-
386-
Whenever you install or update dependencies, you can use the Licensed CLI to
387-
update the licenses database. To install Licensed, see the project's
388-
[Readme](https://github.com/licensee/licensed?tab=readme-ov-file#installation).
389-
390-
To update the cached licenses, run the following command:
391-
392-
```bash
393-
licensed cache
394-
```
395-
396-
To check the status of cached licenses, run the following command:
143+
- Install dependencies:
397144

398145
```bash
399-
licensed status
146+
npm install
400147
```
401148

402-
## Development
149+
- Make sure you have Node.js 20.x or later installed
403150

404151
### Building
405152

406-
To build the action and generate the distribution files:
153+
Package the TypeScript for distribution:
407154

408155
```bash
409156
npm run bundle
410157
```
411158

412-
This will:
413-
414-
1. Format the code with Prettier
415-
2. Compile TypeScript to JavaScript
416-
3. Bundle everything into `dist/index.js`
417-
418159
### Testing
419160

420161
Run the test suite:
@@ -431,16 +172,6 @@ Run ESLint to check for code issues:
431172
npm run lint
432173
```
433174

434-
### Environment Setup
435-
436-
1. Install dependencies:
437-
438-
```bash
439-
npm install
440-
```
441-
442-
2. Make sure you have Node.js 20.x or later installed
443-
444175
### Project Structure
445176

446177
- `src/` - TypeScript source code

0 commit comments

Comments
 (0)