Skip to content

lmllrjr/zigist

Repository files navigation

Zigist - Update a gist with a random dev joke

test cron

Nothing fancy here. This is just a simple github action to update a gist with a random dev joke using Zig ⚡️.

Quick start

uses: lmllrjr/zigist@v1
with:
  gh-token: ${{ secrets.GH_TOKEN }}
  gist-id: e35b7dfc8ec2c958a7f8f0c9938ffd60

Tip

Pin the gist in your profile:

Screenshot 2024-03-18 at 01 00 19
See it in action the wild

Inputs

Input Name Description Required
gh-token The GitHub Personal Access Token with gist access ☑️
gist-id The GitHub public gist id ☑️

Important

gh-token: The GitHub Token needs to be created as a repository secret in the repository that uses this action.1

gist-id: The GitHub gist needs to be created with the file name NEWS.md.2

Example usage

name: cron
on:
schedule:
- cron: "0 5 * * *"
jobs:
update-gist:
runs-on: ubuntu-latest
name: A job update a gist with a random dev joke
steps:
- name: Update gist action step
id: zigist
uses: lmllrjr/zigist@v1
with:
gh-token: ${{ secrets.GH_TOKEN }}
gist-id: ${{ vars.GIST_ID }}

Local environment setup

The following two environment variables need to be set up:

  1. GH_TOKEN: Create a github token that has access to gists.
  2. GIST_ID: Create a gist.

Copy .envrc.example to .envrc and edit values. Load this environment into your shell, for example with direnv.

cp .envrc.example .envrc

Zig

zig build run
zig build test --summary all

Docker

docker build -t ziglang/static-v0.11.0 .
docker run --name zigist ziglang/static-v0.11.0 $GH_TOKEN $GIST_ID

Footnotes

  1. Place repository secret: Screenshot 2024-03-17 at 23 54 25

  2. Create github gist with filename NEWS.md: Screenshot 2024-03-17 at 23 30 13