# Workflow Run Action

This action is responsible for triggering the execution of a workflow in your workspace. This way, you can automate the execution of your workflows within existing CI pipelines.

## Authentication

To authenticate with Chassy API you need to supply an authentication token. Please consult our documentation on how to [generate-chassy-tokens](https://docs.chassy.io/operator-guides/generate-chassy-tokens "mention"). The GitHub action consumes this value from an environment variable called `CHASSY_TOKEN`. Ideally, this secret information is stored within a GitHub action secret (see [GitHub Documentation](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions)) and can then be referenced within your workflows as follows:

```yaml
env:
    CHASSY_TOKEN: ${{ secrets.CHASSY_TOKEN }}
```

With this token provided, you can continue with configuration.

## Configuration

There are three configuration options for this workflow. Only `workflowId` is required. These configurations are all to be made within the `with` block in your actions YAML file.

### Workflow ID

The provided `workflowId` specifies which workflow you wish to run. It is required for the action to function.

### Sync

The optional `sync` boolean parameter (defaults to `true`) allows you to decide whether you want the action to await the completion of your workflow's execution before the action is complete. Turning this off will mean that your workflow isn't checked for successful execution.

### Parameters

The optional `parameters` parameter is a JSON-encoded catch-all for any user-defined data for workflow execution.

## Example

In the example below, our workflow will be executed synchronously with no custom parameters. Afterward, the results will be printed to standard out.

```yaml
example-action:
  name: Example Action
  runs-on: ubuntu-latest
  env:
    CHASSY_TOKEN: <my token>
  steps:
    - name: Run a workflow
      id: workflow-run
      uses: chassyflow/actions-workflow-run@v1.2.0
      with:
        workflowId: '<some workflow id>'
    - name: Print Workflow Output
      id: output
      run: echo "${{ steps.workflow-run.outputs.workflowexecution }}"
```

### Source

The source code for this action can be found in the [official GitHub repository](https://github.com/chassyflow/actions-package-upload).
