A script that removes the ban-sensitive-files module from the devDependencies of microservices hosted on GitHub Enterprise Server. The script performs the following actions for each repository:
- Clone the repository to a local directory
- Create a new branch named
feature/remove-ban-sensitive-filesfrom the given branch name - Remove the
ban-sensitive-filesmodule from thedevDependenciesof thepackage.jsonfile - Rebuild the
package-lock.jsonfile - Commit the changes to the new branch and push them to the remote repository
- Create a pull request with the title "Remove ban-sensitive-files module from dev dependencies" and a message detailing the changes made.
- Node.js 14 or higher
- A valid GitHub Enterprise Server account with appropriate permissions to the repositories
- Clone this repository to your local machine.
- Navigate to the project directory and run
npm installto install the necessary dependencies.
- Modify the
repositoriesandbranchesarrays in theindex.jsfile to include the names of the repositories and branches you want to modify. - Update the
githubCredentialsobject in theindex.jsfile to include your GitHub Enterprise Server credentials. - Run the script by executing the command
npm startin the project directory. - The script will clone each repository, create a new branch, remove the
ban-sensitive-filesmodule, and create a pull request.
The script comes with a set of test cases that can be run using the npm test command. The tests verify the functionality of the script under different scenarios, such as invalid repository or branch names, missing ban-sensitive-files module in package.json, and invalid GitHub credentials.
Contributions are welcome! If you have an idea or suggestion for improving the script, please open an issue or submit a pull request.