Skip to content

Commit

Permalink
Add sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
fabasoad committed Mar 19, 2020
1 parent eacec3b commit 57a8ed7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This action installs one of the brainfuck interpreters called [brainfucky](https://pypi.org/project/brainfucky/).

## Inputs
1. `version` - _[Optional]_ Brainfucky library version.
1. `version` - _[Optional]_ Brainfucky library version. Default is the [latest](https://pypi.org/project/brainfucky/) version.

## Example usage

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
version:
description: 'Brainfucky library version.'
required: false
default: latest
default: null
runs:
using: 'node12'
main: 'src/index.js'
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const core = require('@actions/core');
const exec = require('@actions/exec');
const { exec } = require('@actions/exec');

const version = core.getInput('version');

(async () => {
try {
await exec.exec('pip install brainfucky' + (!version || version === 'latest' ? '' : `==${version}`));
const sudo = process.platform !== 'win32' ? 'sudo ' : '';
await exec(`${sudo}pip install brainfucky` + (version ? `==${version}` : ''));
} catch (e) {
core.setFailed(e.message);
}
Expand Down

0 comments on commit 57a8ed7

Please sign in to comment.