An improved workflow for publishing JavaScript actions

Hey everyone,

I’ve been working on a git extension called hologit for a while now, it’s basically a git-native distributed CI system that lives inside your repo and makes use of Chef Habitat to provide lightweight reusable/disposable execution environments. Publishing JavaScript-based GitHub actions is a perfect use-case for it, and lets you get away from combining sources and build artifacts inside the same branches.

It works via declarative virtual “holobranches” that you define in-band within your source trees:

$ tree . .holo
├── index.js
├── package.json
├── package-lock.json
├── branches
│   ├── github-action
│   │   └── _action-sources.toml
│   └── github-action.lenses
│       └── npm-install.toml
└── config.toml

You can then use the git holo command (with access to a Docker daemon):

$ npm install -g hologit
$ git ls-tree $(git holo project --working github-action)
info: indexing working tree (this can take a while under Docker)...
info: using working tree: d6291e39da7a8f45ca58765d8c4aebe8e04ad7e3
info: reading mappings from holobranch: github-action
info: compositing tree...
info: merging action-sources:{action.yml,*.js,package*.json} -> /
info: stripping .holo/{branches,sources} tree from output tree...
info: building input tree for lens npm-install from {package.json,package-lock.json}
info: found existing output tree matching holospec(9da7adca354ba98ddba51c8c07b391effb71ae9f)
info: merging lens output tree(f18f6efcbad9a20abf1d0ab8622867bf7585d93d) into /
info: stripping .holo/lenses tree from output tree...
info: writing final output tree...
info: projection ready
100755 blob e058ef4d4931ed8bd2e89cf07ef0782b440a0dfa    index.js
040000 tree a1d04abea642261a6d7f97c2ca2160471a075eec    node_modules
100644 blob a0e5b7d7f7bbef44de2ae72c584916b6f00daf7d    package-lock.json
100644 blob 9794b77314980c989647cd8c1f776280abb9092c    package.json

A GitHub action is available for automating the publication of a holobranch:

name: Publish GitHub Action

    branches: [ main ]

    runs-on: ubuntu-latest
    - name: 'Project holobranch github-action to v1'
      uses: JarvusInnovations/hologit@actions/projector/v1
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        HAB_LICENSE: accept
        holobranch: github-action
        commit-to: v1

With that, you can just push/merge to main and v1 will get updated automatically with minimal content and computation. The update is modeled as a merge in your git graph so you can easily track the relationship between your source updates and distribution updates.

I’ve published a complete template repository with further instructions: