# Use Habitat in GitHub Actions workflows

**URL:** <https://discourse.chef.io/t/use-habitat-in-github-actions-workflows/18860>\
**Category:** Habitat Wiki\
**Created:** [December 26, 2019, 4:01pm UTC](https://discourse.chef.io/t/use-habitat-in-github-actions-workflows/18860 "2019-12-26T16:01:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/chris1/32/2143_2.png) [@chris1](https://discourse.chef.io/u/chris1)\
**Post date:** [December 26, 2019, 4:01pm UTC](https://discourse.chef.io/t/use-habitat-in-github-actions-workflows/18860/1 "2019-12-26T16:01:11Z")

</div>

I created this GitHub action to help with using Habitat inside the Linux workflow runner:

> **[JarvusInnovations/habitat-action](https://github.com/JarvusInnovations/habitat-action)**
>
> A GitHub action that turns your workflow runner into a Chef Habitat studio

I needed a way for `hab` commands to all work without `sudo` in the runner environment, so that I could invoke scripts that might `hab pkg install` and then do other stuff without all their other output ending up owned by `root`.

This action installs the latest `hab` binary and then tweaks the environment a bit for rootless use. It can optionally also install a set of packages for you before continuing to your next step:

```auto
name: Build with Chef Habitat
on:
  push:
    branches:
      - master
jobs:
  habitat-build:
    runs-on: ubuntu-latest
    steps:
    - name: 'Initialize Chef Habitat environment'
      uses: JarvusInnovations/habitat-action@master
      env:
        HAB_LICENSE: accept
      with:
        deps: |
          core/git
          core/hab-studio
    - run: hab pkg exec core/git git clone https://github.com/JarvusInnovations/habitat-compose
    - run: hab origin key generate jarvus
    - run: hab pkg build ./habitat-compose/
      env:
        HAB_ORIGIN: jarvus
    # - name: Open tmate/tmux session for remote debug shell
    # uses: mxschmitt/action-tmate@v1

```

See [full usage notes](https://github.com/JarvusInnovations/habitat-action#usage) in README.
