This script uses the GitHub API to list all repository names of a GitHub user and extracts dependencies from the pom.xml
files in a specified repository.
- Node.js installed on your machine. You can download it here.
- Clone this repository to your local machine:
git clone https://github.com/your-username/your-repo.git
- Install the required npm packages:
npm install
- Set up a GitHub personal access token:
- Go to GitHub Settings > Developer settings > Personal access tokens.
- Generate a new token with the repo scope.
- Copy the token.
- Open the index.js file and replace 'YOUR_GITHUB_TOKEN' with the personal access token you generated.
const octokit = new Octokit({
auth: 'YOUR_GITHUB_TOKEN',
});
5.Replace 'YOUR_GITHUB_USERNAME' with your GitHub username and 'REPO_NAME' with the repository name:
const owner = 'YOUR_GITHUB_USERNAME';
const repo = 'REPO_NAME';
- Run the script:
node index.js
The script will output the list of repository names and dependencies from pom.xml files.
GitHub Repository Names:
- repository1
- repository2
- repository3
- Dependencies from pom.xml:
Group: com.example, Artifact: example-library, Version: 1.0.0
Group: org.springframework, Artifact: spring-boot, Version: 2.5.3