Skip to content

Commit

Permalink
Implement get-yaml-paths-action
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuanapoli committed Jan 26, 2020
1 parent d676176 commit 934b093
Show file tree
Hide file tree
Showing 34 changed files with 3,153 additions and 1,201 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install NPM credentials
run: build/write-npmrc.sh
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -31,19 +27,8 @@ jobs:
run: yarn build:license-checker
- name: Test
run: yarn test
- uses: 8398a7/action-slack@v2
with:
status: ${{ job.status }}
author_name: ${{ github.repository }} ${{ github.workflow }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
if: always()
- name: Build
run: yarn build
- name: Publish
run: npm publish
if: startsWith(github.event.ref, 'refs/tags')
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
Expand Down
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2020, Cumulus Digital Systems

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
58 changes: 39 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@
# Package Template
# Get YAML Paths

This is a basic template for Cumulus library packages.
This action reads a YAML file and outputs selected properties.

You can use the template by cloning the template project from https://github.com/CumulusDS/package-template and unpacking into a new directory. Remember to update package.json, appveyor.yml and this documentation with the name and purpose of your new project. Create a new repo on GitHub for the new project. Connect your local repo to the new GitHub repo by changing the origin:
The action uses lodash.get to access properties at the provided paths. The `file` input is the only required input. All other inputs are mapped into equally named outputs with the value at the given paths.

1. Use the [package-template](https://github.com/CumulusDS/package-template) to create a GitHub repo for the new package.
2. Configure standard secrets with the GitHub repo https://github.com/CumulusDS/REPOSITORY/settings/secrets
- `SLACK_WEBHOOK`
- `NODE_AUTH_TOKEN`
3. Clone the new repo.
```bash
git clone https://github.com/CumulusDS/sts-sites.git
```
4. Create the first feature branch in your local repo.
5. Replace `PackageTemplate` and `Package Template` throughout the repo. Edit this file, `package.json` and `appveyor.yml` with the new service name.
6. Push the feature branch. GitHub Actions should automatically build it.
7. Change `"private": true"` in package.json; the "private" flag prevents publishing the package.
7. Open the first pull request.
## Inputs

# Domain Distillation
### `file`

Please define your core domain here.
**Required** The name of the file to load.

### `name: path`

Give each path to look-up as a `name: path` input pair.

## Outputs

The Action generates an output for `name` with the value at the corresponding `path`. Output names are all lowercase, due to limitations in GitHub Actions.

## Example usage

Given an input file `file.yml`:
```yml
foo:
bar: baz
provider:
stage: green
```
A step definition like this:
```
uses: @cumulusds@v0.0.0
with:
file: file.yml
bar: foo.bar
providerStage: provider.stage
```
sets the `baz` output to `bar` and sets the `providerstage` output (note all lower-case) to `green`.

# See Also

[get-json-paths-action](https://github.com/gr2m/get-json-paths-action)

# Development

Expand All @@ -31,4 +51,4 @@ Please define your core domain here.

## License

This package is not licensed.
This package is [MIT licensed](LICENSE).
4 changes: 4 additions & 0 deletions __mocks__/@actions/core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @flow

export const setOutput = jest.fn<$ReadOnlyArray<string>, void>();
export const setFailed = jest.fn<$ReadOnlyArray<string>, void>();
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Get YML Paths
description: A GitHub Action to access values of YAML files
inputs:
file:
description: File to load
required: true
outputs:
time:
description: The time we greeted you
runs:
using: node12
main: dist/main.js
1 change: 1 addition & 0 deletions dist/main.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions env/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
foo:
bar: baz
provider:
stage: green
39 changes: 39 additions & 0 deletions flow-typed/npm/@actions/core_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// flow-typed signature: f71de6293107d39fa6850dafb76ef8e0
// flow-typed version: <<STUB>>/@actions/core_v^1.2.1/flow_v0.112.0

/**
* This is an autogenerated libdef stub for:
*
* '@actions/core'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module '@actions/core' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@actions/core/lib/command' {
declare module.exports: any;
}

declare module '@actions/core/lib/core' {
declare module.exports: any;
}

// Filename aliases
declare module '@actions/core/lib/command.js' {
declare module.exports: $Exports<'@actions/core/lib/command'>;
}
declare module '@actions/core/lib/core.js' {
declare module.exports: $Exports<'@actions/core/lib/core'>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// flow-typed signature: 490370253d0e68b6680eb0378016f143
// flow-typed version: <<STUB>>/@babel/plugin-proposal-nullish-coalescing-operator_v^7.7.4/flow_v0.112.0

/**
* This is an autogenerated libdef stub for:
*
* '@babel/plugin-proposal-nullish-coalescing-operator'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module '@babel/plugin-proposal-nullish-coalescing-operator' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@babel/plugin-proposal-nullish-coalescing-operator/lib/index' {
declare module.exports: any;
}

// Filename aliases
declare module '@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js' {
declare module.exports: $Exports<'@babel/plugin-proposal-nullish-coalescing-operator/lib/index'>;
}
17 changes: 5 additions & 12 deletions flow-typed/npm/babel-eslint_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// flow-typed signature: 2ca0c4b185e300eda6d2e0a6bc69ef25
// flow-typed version: <<STUB>>/babel-eslint_v^8.2.5/flow_v0.112.0
// flow-typed signature: d8a1d0f32ebf12b02eaabd9342d5b74c
// flow-typed version: <<STUB>>/babel-eslint_v10.0.3/flow_v0.112.0

/**
* This is an autogenerated libdef stub for:
Expand Down Expand Up @@ -58,10 +58,6 @@ declare module 'babel-eslint/lib/index' {
declare module.exports: any;
}

declare module 'babel-eslint/lib/parse-with-patch' {
declare module.exports: any;
}

declare module 'babel-eslint/lib/parse-with-scope' {
declare module.exports: any;
}
Expand All @@ -70,7 +66,7 @@ declare module 'babel-eslint/lib/parse' {
declare module.exports: any;
}

declare module 'babel-eslint/lib/patch-eslint-scope' {
declare module 'babel-eslint/lib/require-from-eslint' {
declare module.exports: any;
}

Expand Down Expand Up @@ -106,17 +102,14 @@ declare module 'babel-eslint/lib/babylon-to-espree/toTokens.js' {
declare module 'babel-eslint/lib/index.js' {
declare module.exports: $Exports<'babel-eslint/lib/index'>;
}
declare module 'babel-eslint/lib/parse-with-patch.js' {
declare module.exports: $Exports<'babel-eslint/lib/parse-with-patch'>;
}
declare module 'babel-eslint/lib/parse-with-scope.js' {
declare module.exports: $Exports<'babel-eslint/lib/parse-with-scope'>;
}
declare module 'babel-eslint/lib/parse.js' {
declare module.exports: $Exports<'babel-eslint/lib/parse'>;
}
declare module 'babel-eslint/lib/patch-eslint-scope.js' {
declare module.exports: $Exports<'babel-eslint/lib/patch-eslint-scope'>;
declare module 'babel-eslint/lib/require-from-eslint.js' {
declare module.exports: $Exports<'babel-eslint/lib/require-from-eslint'>;
}
declare module 'babel-eslint/lib/visitor-keys.js' {
declare module.exports: $Exports<'babel-eslint/lib/visitor-keys'>;
Expand Down
18 changes: 16 additions & 2 deletions flow-typed/npm/eslint-config-airbnb-base_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// flow-typed signature: dc6e13bdf46fa65c324d5f67deac9f17
// flow-typed version: <<STUB>>/eslint-config-airbnb-base_v^12.1.0/flow_v0.112.0
// flow-typed signature: 6f892d9134ece91f991a8febccd6229c
// flow-typed version: <<STUB>>/eslint-config-airbnb-base_v14.0.0/flow_v0.112.0

/**
* This is an autogenerated libdef stub for:
Expand Down Expand Up @@ -58,10 +58,18 @@ declare module 'eslint-config-airbnb-base/rules/variables' {
declare module.exports: any;
}

declare module 'eslint-config-airbnb-base/test/requires' {
declare module.exports: any;
}

declare module 'eslint-config-airbnb-base/test/test-base' {
declare module.exports: any;
}

declare module 'eslint-config-airbnb-base/whitespace' {
declare module.exports: any;
}

// Filename aliases
declare module 'eslint-config-airbnb-base/index' {
declare module.exports: $Exports<'eslint-config-airbnb-base'>;
Expand Down Expand Up @@ -96,6 +104,12 @@ declare module 'eslint-config-airbnb-base/rules/style.js' {
declare module 'eslint-config-airbnb-base/rules/variables.js' {
declare module.exports: $Exports<'eslint-config-airbnb-base/rules/variables'>;
}
declare module 'eslint-config-airbnb-base/test/requires.js' {
declare module.exports: $Exports<'eslint-config-airbnb-base/test/requires'>;
}
declare module 'eslint-config-airbnb-base/test/test-base.js' {
declare module.exports: $Exports<'eslint-config-airbnb-base/test/test-base'>;
}
declare module 'eslint-config-airbnb-base/whitespace.js' {
declare module.exports: $Exports<'eslint-config-airbnb-base/whitespace'>;
}
Loading

0 comments on commit 934b093

Please # to comment.