https://github.com/mapado/install-deps-from-pr
Install dependencies according to PR description
https://github.com/mapado/install-deps-from-pr
Last synced: 20 days ago
JSON representation
Install dependencies according to PR description
- Host: GitHub
- URL: https://github.com/mapado/install-deps-from-pr
- Owner: mapado
- License: mit
- Created: 2024-01-02T16:01:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-19T09:15:45.000Z (over 2 years ago)
- Last Synced: 2025-01-10T01:02:12.887Z (over 1 year ago)
- Language: TypeScript
- Size: 122 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# install-deps-from-pr
Install dependencies according to PR description
## Installation
Create the following file in your root package repository `install-deps-from-pr.config.js` (or `install-deps-from-pr.config.mjs` if your package is not a module), with the following default export:
```js
const config = {
currentRepo: 'owner/repo-name', // the current repository name
// A regex or an array of regex that matches a block in your github description
prDescriptionRegex: [
/### Dependencies([\s\S]*?)\n#/,
/### Dependencies([\s\S]*?)$/,
],
// an array of valid repositories that will be searched for this PR
repos: ['owner/cart', 'owner/tools'],
};
export default config;
```
### Using typescript ?
You can use a typescript configuration file named `install-deps-from-pr.config.ts`
```ts
import { Config } from '@mapado/install-deps-from-pr';
const config: Config = {
// your configuration
};
export default config;
```
## Usage
This script needs two environment variables:
- `GITHUB_ACCESS_TOKEN`
- `BRANCH_NAME`
Then execute the following script:
```sh
npx -y @mapado/install-deps-from-pr
```
It will create a `install-deps-from-pr` directory and install thoses dependencies in it.
Then it will launch the following commands:
- `yarn install`
- `yarn build`
And copy the folder into the `node_modules` directory
## Troubleshooting
You may encounter an issue with an infinite build with `npx` never finishing.
If you have this issue, you might want to install the package in your dev dependencies:
```sh
# install one time
yarn add --dev @mapado/install-deps-from-pr
# execute
yarn install-deps-from-pr
```