mirror of
https://github.com/cypress-io/cypress.git
synced 2025-12-30 19:19:53 -06:00
* use env variables in yaml [run ci] * add husky hook to lint-staged to format the circle workflow file on commit when the file changes to keep the diff from the github actions job short * chore: cut over browser-version scripts from json to yaml to update the workflow file inline * Update scripts/format-workflow-file.js Co-authored-by: Matt Schile <mschile@cypress.io> * move expected yaml keys to const variables --------- Co-authored-by: Matt Schile <mschile@cypress.io>
18 lines
526 B
JavaScript
18 lines
526 B
JavaScript
const fs = require('fs')
|
|
const yaml = require('yaml')
|
|
|
|
/**
|
|
* from root of directory run:
|
|
* node ./scripts/format-workflow-file.js
|
|
*
|
|
* This script is also executed as a pre-commit hook in husky to ensure the workflow file is always formatted correctly
|
|
*/
|
|
const formatWorkflowFile = () => {
|
|
// file path is relative to repo root
|
|
const doc = yaml.parseDocument(fs.readFileSync('./.circleci/workflows.yml', 'utf8'))
|
|
|
|
fs.writeFileSync('./.circleci/workflows.yml', yaml.stringify(doc), 'utf8')
|
|
}
|
|
|
|
formatWorkflowFile()
|