Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jcbhmr/hello-world-bun-action
🧅 Demo action using Bun
https://github.com/jcbhmr/hello-world-bun-action
action actions bun example getting-started github-action github-actions hack hello-world
Last synced: 10 days ago
JSON representation
🧅 Demo action using Bun
- Host: GitHub
- URL: https://github.com/jcbhmr/hello-world-bun-action
- Owner: jcbhmr
- License: 0bsd
- Created: 2023-11-01T15:30:33.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-16T01:28:44.000Z (12 months ago)
- Last Synced: 2023-11-16T02:28:42.226Z (12 months ago)
- Topics: action, actions, bun, example, getting-started, github-action, github-actions, hack, hello-world
- Language: TypeScript
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# "Hello world!" GitHub Action using Bun
🦕 Demo action using Bun
```ts
import * as core from "@actions/core";
console.log(`Hello ${core.getInput("name")}!`);
core.setOutput("time", new Date().toLocaleTimeString());
```🟦 Uses TypeScript \
😍 No compile step! \
🧅 Runs on the [Bun runtime] \
👩⚖️ [0BSD licensed] template## Usage
![Bun](https://img.shields.io/static/v1?style=for-the-badge&message=Bun&color=000000&logo=Bun&logoColor=FFFFFF&label=)
![GitHub Actions](https://img.shields.io/static/v1?style=for-the-badge&message=GitHub+Actions&color=2088FF&logo=GitHub+Actions&logoColor=FFFFFF&label=)This is a **template repository** that is meant to be used as a base or example
for your own project. To get started, just click the Use this
template button in the top right of this repository page.After instantiating this template repository, you will need to manually do the
following:1. Write your code in the `main.ts` file. You can use npm packages without
installing them, `node:` builtins, and `Bun.*` APIs.
2. Make sure you edit the `.github/workflows/test-action.yml` test workflow if
you want to test any additional inputs or scenarios.
3. Replace the `LICENSE` file with your preferred software license. Check out
[choosealicense.com] if you're unsure of which one to pick.
4. Replace this `README.md` file with a fancy readme to suit your new GitHub
Action. Make sure you document all your inputs & outputs!
5. Create a new GitHub release and publish your new GitHub Action to the [GitHub
Actions Marketplace]! 🚀You'll notice that the example code takes advantage of [Auto-install] to use npm
packages without specifying them in `package.json`. You can specify a version of
a package to use by adding each package you use to your `package.json` or
`bun.lockb`.You can also use
bun build
to prebundle everything if you prefer```yml
# action.yml
runs:
using: bun1
main: out/main.ts
``````jsonc
// package.json
{
"scripts": {
"build": "bun build src/main.ts --outdir=out --target=bun"
}
}
``````yml
# .github/workflows/publish-action.yml (partial)
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run build
- run: rm -rf node_modules
- uses: jcbhmr/configure-bun-action@v1
- uses: actions4git/add-commit-push@v1
with:
add-force: true
- uses: actions/[email protected]
with:
source-tag: ${{ github.event.release.tag_name }}
```[bun runtime]: https://bun.sh/
[choosealicense.com]: https://choosealicense.com/
[github actions marketplace]: https://github.com/marketplace?type=actions
[0bsd licensed]: https://github.com/jcbhmr/hello-world-deno-action/blob/main/LICENSE
[auto-install]: https://bun.sh/docs/runtime/autoimport