Skip to content

Commit e1ff8d4

Browse files
authored
Initial commit
0 parents  commit e1ff8d4

19 files changed

+5528
-0
lines changed

.env.yarn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NODE_OPTIONS=--experimental-vm-modules

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/** -diff linguist-generated
2+
yarn.lock -diff linguist-generated

.github/dependabot.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
commit-message:
8+
prefix: chore
9+
labels: [chore]
10+
11+
- package-ecosystem: npm
12+
directory: /
13+
schedule:
14+
interval: daily
15+
commit-message:
16+
prefix: chore
17+
labels: [chore]
18+
versioning-strategy: increase

.github/workflows/build.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
jobs:
8+
build-action:
9+
name: Build Action
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- name: Checkout Project
13+
uses: actions/[email protected]
14+
15+
- name: Setup Node.js
16+
uses: actions/[email protected]
17+
with:
18+
node-version-file: .nvmrc
19+
20+
- name: Setup Yarn
21+
uses: threeal/[email protected]
22+
23+
- name: Check Formatting
24+
run: |
25+
yarn format
26+
git diff && git diff-index --quiet --exit-code HEAD
27+
28+
- name: Check Lint
29+
run: yarn lint
30+
31+
- name: Test Action
32+
run: yarn test
33+
34+
- name: Build Action
35+
run: |
36+
yarn build
37+
git diff && git diff-index --quiet --exit-code HEAD

.github/workflows/test.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Test
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
jobs:
8+
test-action:
9+
name: Test Action
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [ubuntu-22.04, macos-14, windows-2022]
15+
steps:
16+
- name: Checkout Action
17+
uses: actions/[email protected]
18+
with:
19+
path: mkdir-action
20+
sparse-checkout: |
21+
action.yml
22+
dist
23+
sparse-checkout-cone-mode: false
24+
25+
- name: Create Directory
26+
uses: ./mkdir-action
27+
with:
28+
path: parent/child
29+
30+
- name: Check Directory
31+
shell: bash
32+
run: test -d parent/child

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.*
2+
!.env.yarn
3+
!.git*
4+
!.nvmrc
5+
6+
node_modules/

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v23.2.0

LICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <http://unlicense.org/>

README.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<!-- TODO: Replace the content of this file with the new project description. -->
2+
3+
# Action Starter
4+
5+
A minimalist template for starting a new [GitHub Action](https://github.com/features/actions) project.
6+
7+
This template provides a basic GitHub Action project containing a sample [JavaScript action](https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-javascript-action) written in [TypeScript](https://www.typescriptlang.org/), with built-in support for formatting, linting, testing, and continuous integration.
8+
9+
## Key Features
10+
11+
- Minimal GitHub Action project written in TypeScript with [ESM](https://nodejs.org/api/esm.html) support.
12+
- Uses [Yarn](https://yarnpkg.com/) as the package manager with [Plug'n'Play](https://yarnpkg.com/features/pnp) support.
13+
- Supports formatting with [Prettier](https://prettier.io/), linting with [ESLint](https://eslint.org/), and testing with [Jest](https://jestjs.io/).
14+
- Preconfigured workflows for [Dependabot](https://docs.github.com/en/code-security/dependabot) and [GitHub Actions](https://github.com/features/actions).
15+
16+
## Usage
17+
18+
This guide explains how to use this template to start a new GitHub Action project, from creation to release.
19+
20+
### Create a New Project
21+
22+
Follow [this link](https://github.com/new?template_name=action-starter&template_owner=threeal) to create a new project based on this template. For more information about creating a repository from a template on GitHub, refer to [this documentation](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template).
23+
24+
Alternatively, you can clone this repository locally to begin using this template.
25+
26+
### Choose a License
27+
28+
By default, this template is [unlicensed](https://unlicense.org/). Before modifying this template, replace the [`LICENSE`](./LICENSE) file with the license to be used by the new project. For more information about licensing a repository, refer to [this documentation](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository).
29+
30+
Alternatively, you can remove the `LICENSE` file or leave it as-is to keep the new project unlicensed.
31+
32+
### Update Project Information
33+
34+
To replace the sample information in this template with details about your new project, complete the following steps:
35+
36+
- Replace the content of this [`README.md`](./README.md) file with a description of the new project. For more information on adding READMEs to a project, refer to [this documentation](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes).
37+
- Modify the action metadata in the [`action.yml`](./action.yml) file according to the new project specifications. For more details on the action metadata, refer to [this documentation](https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions).
38+
39+
> Note: You can also search for `TODO` comments for a list of information that needs to be replaced.
40+
41+
### Set Up Tools
42+
43+
It is recommended to use [nvm](https://github.com/nvm-sh/nvm) to manage the Node.js version in the project. By default, this template uses the Node.js version specified in the [`.nvmrc`](./.nvmrc) file. Use the following command to install and use the correct Node.js version with nvm:
44+
45+
```sh
46+
nvm install
47+
```
48+
49+
This template uses [Yarn](https://yarnpkg.com/) with [Plug'n'Play](https://yarnpkg.com/features/pnp) support as the package manager. If Yarn is not yet enabled, run the following command:
50+
51+
```sh
52+
corepack enable yarn
53+
```
54+
55+
Then, install the project dependencies with:
56+
57+
```sh
58+
yarn install
59+
```
60+
61+
For more information on Yarn, such as adding dependencies or running tools, refer to [this documentation](https://yarnpkg.com/getting-started).
62+
63+
### Developing the Action
64+
65+
Write the logic for the action in the [`src/main.ts`](./src/main.ts) file according to the project requirements. If you're new to [TypeScript](https://www.typescriptlang.org/), refer to [this documentation](https://www.typescriptlang.org/docs/) for guidance.
66+
67+
If the action will support pre- and post-steps, additional files like `src/pre.ts` and `src/post.ts` can be added. Just make sure to update the Rollup configuration in the [`rollup.config.js`](./rollup.config.js) file and the action metadata in the [`action.yml`](./action.yml) file.
68+
69+
Once the code is written, format it with:
70+
71+
```sh
72+
yarn format
73+
```
74+
75+
Then, check linting with:
76+
77+
```sh
78+
yarn lint
79+
```
80+
81+
Lastly, build and bundle the action files with:
82+
83+
```sh
84+
yarn build
85+
```
86+
87+
### Testing the Action
88+
89+
Test files in this template are named `*.test.ts` and typically correspond to the source files being tested. This template uses [Jest](https://jestjs.io/) as the testing framework. For more information on testing with Jest, refer to [this documentation](https://jestjs.io/docs/getting-started).
90+
91+
After creating your test files, run tests with:
92+
93+
```sh
94+
yarn test
95+
```
96+
97+
Additionally, you can test the action by running it directly from the GitHub workflow as specified in the [`.github/workflows/test.yaml`](./.github/workflows/test.yaml) file.
98+
99+
### Release the Action
100+
101+
When the project is complete, release and publish it from the project repository page on GitHub. For more information on releasing a project, refer to [this documentation](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases). For more information on publishing GitHub actions, refer to [this documentation](https://docs.github.com/en/actions/sharing-automations/creating-actions/publishing-actions-in-github-marketplace).

action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# TODO: Modify the following metadata according to the project's specifications.
2+
3+
name: Mkdir Action
4+
author: Alfi Maulana
5+
description: Create a new directory
6+
branding:
7+
icon: folder-plus
8+
color: black
9+
inputs:
10+
path:
11+
description: Path of the directory to create
12+
required: true
13+
runs:
14+
using: node20
15+
main: dist/main.bundle.mjs

0 commit comments

Comments
 (0)