Skip to content

Commit

Permalink
initial setup action script
Browse files Browse the repository at this point in the history
  • Loading branch information
miki725 committed Oct 5, 2023
1 parent f9a7c77 commit 2465574
Show file tree
Hide file tree
Showing 5 changed files with 398 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: setup

on:
pull_request:

permissions:
contents: read

jobs:
verify:
runs-on: ubuntu-latest

concurrency:
# only allow one job per PR running
# older pending jobs will be cancelled not to waste CI minutes
# cannot use github.job here https://github.com/community/community/discussions/13496
group: ${{ github.workflow }}-setup-${{ github.ref }}
cancel-in-progress: true

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Chalk
uses: ./

- name: Verify Setup
run: |
echo 'log_level: "trace"' | sudo tee /etc/chalk.conf
set -x
which chalk
which docker
chalk version
docker version
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tags
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Setup Chalk

GitHub Action to setting up [Chalk].

This action will install `chalk` and will also wrap other commands
`chalk` supports such as `docker`.

## Usage

```yaml
name: ci

on:
push:

jobs:
buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Chalk
uses: crashappsec/setup-chalk-version
```
## Customizing
The following parameters can be provided to the action.
| Name | Type | Default | Description |
| --------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------- |
| `version` | String | | Version of chalk to install. By default latest version is installed. See [releases] for all available versions. |
| `load` | String | | Chalk config to load. Can be either path to a file or an URL. |

For example:

```yaml
- name: Set up Chalk
uses: crashappsec/setup-chalk-version
with:
version: "0.1.2"
```

[chalk]: https://github.com/crashappsec/chalk/
[releases]: https://crashoverride.com/releases
37 changes: 37 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Setup Chalk
description: Install chalk and wrap supported commands

inputs:
version:
description: |
Version of chalk to install.
By default latest version is installed.
See https://crashoverride.com/releases for all available versions.
required: false
load:
description: |
Chalk config to load.
Can be either path to a file or an URL.
required: false

runs:
using: "composite"
steps:
# https://docs.sigstore.dev/system_config/installation/
- name: Install cosign
uses: sigstore/cosign-installer@main

- name: Add Chalk to PATH
shell: bash
run: |
echo "$HOME/.chalk/bin" >> $GITHUB_PATH
- name: Set up chalk
shell: bash
working-directory: ${{ github.action_path }}
run: |
./setup.sh \
--version=${{ inputs.version }} \
--load=${{ inputs.load }} \
--prefix=$HOME/.chalk \
${{ runner.debug == '1' && '--debug' || '' }}
Loading

0 comments on commit 2465574

Please sign in to comment.