Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix docs #178

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

54 changes: 0 additions & 54 deletions .eslintrc.json

This file was deleted.

23 changes: 10 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
name: 'build-test'
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- 'releases/*'

on: [push]
jobs:
build: # make sure build/ci work properly
execute-sg-cli:
runs-on: ubuntu-latest
name: StackGuardian CLI Github Action
env:
SG_API_TOKEN: 'sgu_xyz'
steps:
- uses: actions/checkout@v2
- run: |
npm install
- run: |
npm run all
- name: StackGuardian/workflow-run-action
uses: ./ # Uses an action in the root directory
id: StackGuardian-CLI
with:
operation: "--help"
122 changes: 24 additions & 98 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,99 +1,25 @@
# Dependency directory
node_modules

# Visual Studio Config
.vscode

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
jspm_packages/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# OS metadata
# Docker project generated files to ignore
# if you want to ignore files created by your editor/tools,
# please consider a global .gitignore https://help.github.com/articles/ignoring-files
.vagrant*
bin
docker/docker
.*.swp
a.out
*.orig
build_src
.flymake*
.idea
.DS_Store
Thumbs.db

# Ignore built ts files
__tests__/runner/*
lib/**/*
docs/_build
docs/_static
docs/_templates
.gopath/
.dotcloud
*.test
bundles/
.hg/
.git/
vendor/pkg/
pyenv
Vagrantfile
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

10 changes: 0 additions & 10 deletions .prettierrc.json

This file was deleted.

17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Container image that runs your code
FROM alpine:3.10

# Install necessary tools
RUN apk --no-cache add bash wget jq curl

# Download and extract StackGuardian CLI release
RUN wget -q "$(wget -qO- "https://api.github.com/repos/stackguardian/sg-cli/releases/latest" | jq -r '.tarball_url')" -O sg-cli.tar.gz \
&& tar -xf sg-cli.tar.gz \
&& rm -f sg-cli.tar.gz \
&& mv StackGuardian-sg-cli*/sg-cli /usr/local/bin/ \
&& rm -rf StackGuardian-sg-cli*

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2022 StackGuardian
Copyright 2024 StackGuardian

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
59 changes: 14 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,23 @@
<p align="center">
<a href="https://github.com/stackguardian/workflow-run-action/actions"><img alt="typescript-action status" src="https://github.com/actions/typescript-action/workflows/build-test/badge.svg"></a>
</p>
# StackGuardian CLI docker action

# Run a workflow run
This action interacts with [sg-cli](https://github.com/StackGuardian/sg-cli/blob/main/README.md).

This action enables you to run a workflow on StackGuardian platform.
## Inputs

## Usage
## `operation`

Add the following entry to your Github workflow YAML file with the required inputs:
**Required** The sg-cli operation like `"workflow create ..."` or `"stack create ..."`.

```yaml
uses: stackguardian/workflow-run-action@v1
with:
orgId: 'http://exampleUrl'
workflowGroupId: 'username'
workflowId: ${{ secrets.password }}
apiKey: 'system'
```

### Required Inputs
The following inputs are required to use this action:

| Input | Description |
| --- | --- |
| `orgId` | Org Id |
| `workflowGroupId` | Workflow Group Id |
| `workflowId` | Workflow Id |
| `apiKey` | Specifies a Github encrypted secret for accessing the StackGuardian API. Refer to the [Encrypted Secrets Documentation](https://docs.github.com/en/actions/reference/encrypted-secrets) for details on how to create an encrypted secret. |

### Optional Inputs
None
## Environment variables

## Build and Test this Action Locally
## `SG_API_TOKEN`

1. Install the dependencies:
```bash
$ npm install
```
**Required** StackGuardian API Token. Retrieve on the platform at `https://app.stackguardian.io/orchestrator/orgs/<YOUR_SG_ORG>/settings?tab=api_key/`.

2. Build the typescript and package it for distribution:
```bash
$ npm run build && npm run package
```
## Example usage

3. Run the tests:
```bash
$ npm test

PASS ./index.test.js

...
```
```yaml
uses: stackguardian/workflow-run-action
with:
operation: 'workflow create --bulk --org demo-org --workflow-group demo-grp -- payload.json'
```
59 changes: 0 additions & 59 deletions __tests__/main.test.ts

This file was deleted.

Loading
Loading