├── .github └── workflows │ └── checkin.yml ├── .gitignore ├── LICENSE ├── README.md ├── __tests__ └── main.test.ts ├── action.yml ├── docs └── contributors.md ├── jest.config.js ├── package-lock.json ├── package.json ├── src └── main.ts └── tsconfig.json /.github/workflows/checkin.yml: -------------------------------------------------------------------------------- 1 | name: "PR Checks" 2 | on: [pull_request, push] 3 | 4 | jobs: 5 | check_pr: 6 | runs-on: ${{ matrix.os }} 7 | strategy: 8 | fail-fast: false 9 | matrix: 10 | os: [ubuntu-latest, windows-latest, macOS-latest] 11 | 12 | steps: 13 | - uses: actions/checkout@v1 14 | 15 | - uses: actions/setup-node@v1 16 | 17 | - name: "npm ci" 18 | run: npm ci 19 | 20 | - name: "npm run build" 21 | run: npm run build 22 | 23 | - name: "Setup pipenv using this branch's action" 24 | uses: "./" 25 | 26 | - run: "pipenv --help" 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | __tests__/runner/* 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2018 GitHub, Inc. and contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Github Action to install pipenv 2 | 3 |
6 | 7 | This action sets up a pipenv for use in actions by: 8 | 9 | - installing a version of pipenv with your configured version of python 10 | 11 | # Usage 12 | 13 | See [action.yml](action.yml) 14 | 15 | Basic: 16 | ```yaml 17 | steps: 18 | - uses: actions/checkout@master 19 | - uses: actions/setup-python@v1 20 | - uses: dschep/install-pipenv-action@v1 21 | - run: pipenv run my_script.py 22 | ``` 23 | 24 | With a specific version: 25 | ```yaml 26 | - uses: dschep/install-pipenv-action@v1 27 | with: 28 | version: 2018.11.26 29 | ``` 30 | 31 | # License 32 | 33 | The scripts and documentation in this project are released under the [MIT License](LICENSE) 34 | 35 | # Contributions 36 | 37 | Contributions are welcome! See [Contributor's Guide](docs/contributors.md) 38 | -------------------------------------------------------------------------------- /__tests__/main.test.ts: -------------------------------------------------------------------------------- 1 | describe('TODO - Add a test suite', () => { 2 | it('TODO - Add a test', async () => {}); 3 | }); 4 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Install pipenv' 2 | description: 'Install pipenv, Python Dev Workflow for Humans in your environment' 3 | author: 'Daniel Schep' 4 | inputs: 5 | version: 6 | description: 'version' 7 | default: null 8 | branding: 9 | icon: package 10 | color: green 11 | runs: 12 | using: 'node12' 13 | main: 'lib/main.js' 14 | -------------------------------------------------------------------------------- /docs/contributors.md: -------------------------------------------------------------------------------- 1 | # Contributors 2 | 3 | ### Checkin 4 | 5 | - Do checkin source (src) 6 | - Do checkin build output (lib) 7 | - Do checkin runtime node_modules 8 | - Do not checkin devDependency node_modules (husky can help see below) 9 | 10 | ### devDependencies 11 | 12 | In order to handle correctly checking in node_modules without devDependencies, we run [Husky](https://github.com/typicode/husky) before each commit. 13 | This step ensures that formatting and checkin rules are followed and that devDependencies are excluded. To make sure Husky runs correctly, please use the following workflow: 14 | 15 | ``` 16 | npm install # installs all devDependencies including Husky 17 | git add abc.ext # Add the files you've changed. This should include files in src, lib, and node_modules (see above) 18 | git commit -m "Informative commit message" # Commit. This will run Husky 19 | ``` 20 | 21 | During the commit step, Husky will take care of formatting all files with [Prettier](https://github.com/prettier/prettier) as well as pruning out devDependencies using `npm prune --production`. 22 | It will also make sure these changes are appropriately included in your commit (no further work is needed) -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | clearMocks: true, 3 | moduleFileExtensions: ['js', 'ts'], 4 | testEnvironment: 'node', 5 | testMatch: ['**/*.test.ts'], 6 | testRunner: 'jest-circus/runner', 7 | transform: { 8 | '^.+\\.ts$': 'ts-jest' 9 | }, 10 | verbose: true 11 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node12-template-action", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "Node 12 template action", 6 | "main": "lib/main.js", 7 | "scripts": { 8 | "build": "tsc", 9 | "test": "jest" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/actions/node12-template.git" 14 | }, 15 | "keywords": [ 16 | "actions", 17 | "node", 18 | "setup" 19 | ], 20 | "author": "GitHub", 21 | "license": "MIT", 22 | "dependencies": { 23 | "@actions/core": "^1.0.0", 24 | "@actions/io": "^1.0.0", 25 | "@actions/exec": "^1.0.0", 26 | "@actions/github": "^1.0.0", 27 | "@actions/tool-cache": "^1.0.0", 28 | "semver": "^6.1.1" 29 | }, 30 | "devDependencies": { 31 | "@types/jest": "^24.0.13", 32 | "@types/node": "^12.0.4", 33 | "@types/semver": "^6.0.0", 34 | "jest": "^24.8.0", 35 | "jest-circus": "^24.7.1", 36 | "ts-jest": "^24.0.2", 37 | "typescript": "^3.5.1" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import * as core from '@actions/core'; 2 | const { exec } = require('@actions/exec'); 3 | 4 | async function run() { 5 | try { 6 | const version = core.getInput('version'); 7 | const pkg = version ? `pipenv==${version}` : 'pipenv'; 8 | const sudo = process.platform !== 'win32' ? 'sudo ' : ''; 9 | await exec(`${sudo}pip install ${pkg}`) 10 | } catch (error) { 11 | core.setFailed(error.message); 12 | } 13 | } 14 | 15 | run(); 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Basic Options */ 4 | // "incremental": true, /* Enable incremental compilation */ 5 | "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ 6 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ 7 | // "allowJs": true, /* Allow javascript files to be compiled. */ 8 | // "checkJs": true, /* Report errors in .js files. */ 9 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 10 | // "declaration": true, /* Generates corresponding '.d.ts' file. */ 11 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 12 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 13 | // "outFile": "./", /* Concatenate and emit output to single file. */ 14 | "outDir": "./lib", /* Redirect output structure to the directory. */ 15 | "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 16 | // "composite": true, /* Enable project compilation */ 17 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 18 | // "removeComments": true, /* Do not emit comments to output. */ 19 | // "noEmit": true, /* Do not emit outputs. */ 20 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 21 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 22 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 23 | 24 | /* Strict Type-Checking Options */ 25 | "strict": true, /* Enable all strict type-checking options. */ 26 | "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */ 27 | // "strictNullChecks": true, /* Enable strict null checks. */ 28 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */ 29 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 30 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 31 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 32 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 33 | 34 | /* Additional Checks */ 35 | // "noUnusedLocals": true, /* Report errors on unused locals. */ 36 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 37 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 38 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 39 | 40 | /* Module Resolution Options */ 41 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 42 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 43 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 44 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 45 | // "typeRoots": [], /* List of folders to include type definitions from. */ 46 | // "types": [], /* Type declaration files to be included in compilation. */ 47 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 48 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 49 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 50 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 51 | 52 | /* Source Map Options */ 53 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 54 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 55 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 56 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 57 | 58 | /* Experimental Options */ 59 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 60 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 61 | }, 62 | "exclude": ["node_modules", "**/*.test.ts"] 63 | } 64 | --------------------------------------------------------------------------------