Scripts in GitHub actions (preview)

tl;dr Here's an example repo

The example script creates a release, downloads an image, and uploads it to the release.

https://github.com/johnlindquist/kit-action-example

Template Repo

This page has a "one-click" clone so you can add/play with your own script.

https://github.com/johnlindquist/kit-action-template

What is it?

Use any of your scripts in a GitHub action. use the kit-action and point it to a scripts in your scripts dir:

name: "example"
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
example:
runs-on: ubuntu-latest
steps:
- name: Script Kit
uses: johnlindquist/kit-action@main
with:
script: "example-script" # The name of a script in your ./scripts dir

Add env vars:

You most likely add "secrets" to GitHub actions, so you'll want to pass them to your scripts as environment variables:

jobs:
example:
runs-on: ubuntu-latest
steps:
- name: Script Kit
uses: johnlindquist/kit-action@main
with:
script: "example-script"
env:
REPO_TOKEN: "${{ secrets.REPO_TOKEN }}" # load in your script with await env("REPO_TOKEN")

Works with your existing repos

Feel free to add this action and a scripts dir to your existing repos. It automatically loads in your repo so you can parse package.json, compress assets, or whatever it is you're looking to add to your CI.

What does "preview" mean?

Everything is working, but it's pointing to the "main" branch rather than a tagged version. Once I get some feedback, I'll tag a "1.0" version so you can uses: @johlindquist/kit-action@v1

Please ask for help! 😇

I'd ❤️ to help you script something for a github action! Please let me know whatever I can do to help.

Discuss Post