Fix arguments

This commit is contained in:
Shivam Mathur
2020-02-29 15:42:01 +05:30
parent a3c9016503
commit b354d92cc6
4 changed files with 8 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ jest.mock('../src/cache', () => ({
const script_path = 'extensions.sh'; const script_path = 'extensions.sh';
return ( return (
'bash ' + script_path + ' "' + extensions + '-' + key + '" ' + version 'bash ' + script_path + ' "' + extensions + '" ' + key + ' ' + version
); );
} }
) )
@@ -42,13 +42,13 @@ describe('Install', () => {
setEnv('7.0', 'xdebug, pcov', 'cache-v1'); setEnv('7.0', 'xdebug, pcov', 'cache-v1');
// @ts-ignore // @ts-ignore
const script: string = await install.run(); const script: string = await install.run();
expect(script).toContain('bash extensions.sh "xdebug, pcov-cache-v1" 7.0'); expect(script).toContain('bash extensions.sh "xdebug, pcov" cache-v1 7.0');
}); });
it('Test Run', async () => { it('Test Run', async () => {
setEnv('7.4', 'xdebug, zip', 'cache-v2'); setEnv('7.4', 'xdebug, zip', 'cache-v2');
// @ts-ignore // @ts-ignore
const script: string = await install.run(); const script: string = await install.run();
expect(script).toContain('bash extensions.sh "xdebug, zip-cache-v2" 7.4'); expect(script).toContain('bash extensions.sh "xdebug, zip" cache-v2 7.4');
}); });
}); });

2
dist/index.js vendored
View File

@@ -1555,7 +1555,7 @@ function run() {
const extensions = yield utils.getInput('extensions', true); const extensions = yield utils.getInput('extensions', true);
const key = yield utils.getInput('key', true); const key = yield utils.getInput('key', true);
const script_path = path.join(__dirname, '../src/extensions.sh'); const script_path = path.join(__dirname, '../src/extensions.sh');
yield exec_1.exec('bash ' + script_path + ' "' + extensions + '-' + key + '" ' + version); yield exec_1.exec('bash ' + script_path + ' "' + extensions + '" ' + key + ' ' + version);
} }
catch (error) { catch (error) {
core.setFailed(error.message); core.setFailed(error.message);

View File

@@ -14,7 +14,7 @@ export async function run(): Promise<void> {
const key: string = await utils.getInput('key', true); const key: string = await utils.getInput('key', true);
const script_path: string = path.join(__dirname, '../src/extensions.sh'); const script_path: string = path.join(__dirname, '../src/extensions.sh');
await exec( await exec(
'bash ' + script_path + ' "' + extensions + '-' + key + '" ' + version 'bash ' + script_path + ' "' + extensions + '" ' + key + ' ' + version
); );
} catch (error) { } catch (error) {
core.setFailed(error.message); core.setFailed(error.message);

View File

@@ -44,8 +44,9 @@ get_apiv() {
esac esac
} }
version=$2
extensions=$1 extensions=$1
key=$2
version=$3
os=$(uname -s) os=$(uname -s)
if [ "$os" = "Linux" ]; then if [ "$os" = "Linux" ]; then
flags='-Po' flags='-Po'
@@ -68,6 +69,6 @@ else
os="Windows" os="Windows"
dir='C:\\tools\\php\\ext' dir='C:\\tools\\php\\ext'
fi fi
key="$os"-ext-"$version"-$(echo -n "$extensions" | openssl dgst -sha256 | cut -d ' ' -f 2) key="$os"-ext-"$version"-$(echo -n "$extensions-$key" | openssl dgst -sha256 | cut -d ' ' -f 2)
echo "::set-output name=dir::$dir" echo "::set-output name=dir::$dir"
echo "::set-output name=key::$key" echo "::set-output name=key::$key"