Skip to content

Commit

Permalink
relaxed restrictions on custom auto-setup command (#35)
Browse files Browse the repository at this point in the history
* relaxed restrictions on custom auto-setup command

* relaxed restrictions on custom auto-setup command part 2

* relaxed restrictions on custom auto-setup command part 3
  • Loading branch information
pirog authored Apr 10, 2024
1 parent 9606a79 commit 5fa2904
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-actions-config-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
setup-lando-os-test:
setup-lando-actions-config-test:
runs-on: ${{ matrix.os }}
env:
term: xterm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-actions-file-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
setup-lando-os-test:
setup-lando-actions-file-test:
runs-on: ${{ matrix.os }}
env:
term: xterm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-actions-os-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
setup-lando-os-test:
setup-lando-actions-os-test:
runs-on: ${{ matrix.os }}
env:
term: xterm
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pr-actions-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
setup-lando-os-test:
setup-lando-actions-setup-test:
runs-on: ${{ matrix.os }}
env:
term: xterm
Expand Down Expand Up @@ -36,6 +36,7 @@ jobs:
- disabled
- lando setup
- lando setup --skip-common-plugins --plugin @lando/node --orchestrator 2.21.0
- lando plugin-add @lando/php && lando setup
# these will fail
# - lando.dev something
# - oihywpihgklnw
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-actions-versions-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
setup-lando-os-test:
setup-lando-actions-versions-test:
runs-on: ${{ matrix.os }}
env:
term: xterm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-posix-script-bad-versions-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
setup-lando-os-test:
setup-lando-posix-bad-versions-test:
runs-on: ${{ matrix.os }}
env:
term: xterm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-posix-script-curl-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
setup-lando-os-test:
setup-lando-posix-curl-test:
runs-on: ${{ matrix.os }}
env:
term: xterm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-posix-script-os-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
setup-lando-os-test:
setup-lando-posix-os-test:
runs-on: ${{ matrix.os }}
env:
term: xterm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-posix-script-replacer-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
setup-lando-replacer-test:
setup-lando-posix-replacer-test:
runs-on: ${{ matrix.os }}
env:
term: xterm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-posix-script-versions-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
setup-lando-os-test:
setup-lando-posix-versions-test:
runs-on: ${{ matrix.os }}
env:
term: xterm
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v3.0.3 - [April 10, 2024](https://github.com/lando/setup-lando/releases/tag/v3.0.3)

### GitHub Actions

* Relaxed `auto-setup` validation so it only needs to contain `lando setup`

## v3.0.2 - [April 5, 2024](https://github.com/lando/setup-lando/releases/tag/v3.0.2)

### POSIX Install Script
Expand Down
13 changes: 2 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"js-yaml": "^4.1.0",
"lodash.get": "^4.4.2",
"lodash.set": "^4.3.2",
"semver": "^7.5.4",
"string-argv": "^0.3.2"
"semver": "^7.5.4"
},
"devDependencies": {
"@babel/core": "^7.21.5",
Expand Down
4 changes: 2 additions & 2 deletions setup-lando.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ const main = async () => {

// if we get here then we should be G2G
} else {
const args = parseSetupCommand(getSetupCommand(inputs.setup));
const command = parseSetupCommand(getSetupCommand(inputs.setup), landoPath);
const opts = {env: {...process.env, LANDO_DEBUG: core.isDebug() || inputs.debug}};
await exec.exec(landoPath, args, opts);
await exec.exec('bash', ['-c', command], opts);
}
}

Expand Down
16 changes: 6 additions & 10 deletions utils/parse-setup-command.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
'use strict';

const {parseArgsStringToArgv} = require('string-argv');

module.exports = command => {
module.exports = (command, landoBin = 'lando') => {
// throw if not a string
if (typeof command !== 'string') throw new Error('Setup command must be a string!');
// parse string
command = parseArgsStringToArgv(command);
// validate a few things
if (command[0] !== 'lando' || command[1] !== 'setup') {
throw new Error(`Setup command must begin with "lando setup"! You tried to run "${command.join(' ')}"`);
if (!command.includes('lando setup')) {
throw new Error(`Setup command must include "lando setup"! You tried to run "${command}"`);
}
// remove first lando because we only care about the args
command.shift();
return command;

// return command but with lando invocations replaced with absolute paths to the landoBin
return command.replace(/lando /g, `${landoBin} `);
};

0 comments on commit 5fa2904

Please sign in to comment.