Skip to content

Commit

Permalink
feat(build-workspace-matrix): build dynamic work matrix based on glob…
Browse files Browse the repository at this point in the history
…s and changed files (#4)
  • Loading branch information
mdobosz-isp authored May 18, 2020
1 parent 43baf46 commit df3e16f
Show file tree
Hide file tree
Showing 7 changed files with 28,321 additions and 0 deletions.
52 changes: 52 additions & 0 deletions build-workspace-matrix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# build-workspace-matrix

Builds a matrix of workspaces based on glob patterns and analysis of which files have changed

## Inputs

### `github-token`

**Required** The GitHub API token to use.

### `workspaces`

**Required** A newline-separated list of globs representing specific workspaces.

### `global_dependencies`

A newline-separated list of globs representing dependencies of each workspace. If any of the dependencies have changed then all workspaces will be returned.

## Outputs

### `matrix`

The matrix object of the following shape:

```json
{
"workspace": [
"match1",
"match2"
]
}
```

## Example usage

````
determine-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.build-workspace-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@master
- id: build-workspace-matrix
uses: iStreamPlanet/github-actions/build-workspace-matrix@master
with:
github-token: ${{secrets.GITHUB_TOKEN}}
workspace_globs: |
terraform/clusters/*/
dependency_globs: |
terraform/modules/**/*.tf
.github/workflows/terraform_diff.yml
````
18 changes: 18 additions & 0 deletions build-workspace-matrix/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "build-workspace-matrix"
description: "Builds a matrix of workspaces based on glob patterns and analysis of which files have changed"
inputs:
github-token:
description: The GitHub token used to create an authenticated client
required: true
workspaces:
description: "A newline-separated list of globs representing specific workspaces"
required: true
global_dependencies:
description: "A newline-separated list of globs representing dependencies of each workspace. If any of the dependencies have changed then all workspaces will be returned."
required: false
outputs:
matrix:
description: "The matrix object of the shape: { workspace: [] }"
runs:
using: "node12"
main: "dist/index.js"
Loading

0 comments on commit df3e16f

Please sign in to comment.