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

GitHub Actions #191

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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
52 changes: 52 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: sfcc-ci

on:
push:
pull_request:

env:
GITHUB: ${{ toJson(github) }}

defaults:
run:
shell: bash

jobs:
workflow:
name: workflow
runs-on: ubuntu-latest
steps:
- id: check-out
name: Check out
uses: actions/checkout@v2

- id: cache
name: Cache
uses: actions/cache@v2
with:
path: |
**/node_modules
key: node-modules-${{ hashFiles('package.json') }}

- id: install-dependencies
name: Install dependencies
uses: actions/setup-node@v1
if: steps.cache.outputs.cache-hit != 'true'
- run: |
npm install

- id: lint
name: Lint
run: |
npm run lint

- id: version
name: Version
uses: ./
with:
command: 'sfcc-ci --version'

- id: version-result
name: Version result
run: |
echo "${{ steps.version.outputs.result }}"
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
coverage
dist
node_modules
.*
*.iml
*.iml
21 changes: 21 additions & 0 deletions action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const core = require('@actions/core');
const exec = require('@actions/exec');

(async () => {
try {
const command = core.getInput('command', { required: true });

let result = '';
await exec.exec('node', command.replace('sfcc-ci', 'cli.js').split(' ').filter(c => c !== ''), {
listeners: {
stdout: (data) => {
result += data.toString();
}
}
});

core.setOutput('result', result);
} catch (error) {
core.setFailed(error.message);
}
})();
21 changes: 21 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'sfcc-ci'

description: 'Command line tool to allow Continuous Integration practices with Salesforce Commerce Cloud instances'

author: 'Salesforce'

branding:
icon: 'cloud'
color: 'blue'

inputs:
command:
description: 'Command'
required: false
outputs:
result:
description: 'Result'

runs:
using: 'node12'
main: './action.js'
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"license": "BSD-3-Clause",
"homepage": "https://github.com/SalesforceCommerceCloud/sfcc-ci#readme",
"dependencies": {
"@actions/core": "1.2.6",
"@actions/exec": "1.0.4",
"chalk": "^2.4.1",
"commander": "^2.18.0",
"conf": "^4.0.2",
Expand Down