mirror of
https://github.com/ION606/commit_grabber.git
synced 2026-05-14 22:06:53 +00:00
initial commit
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
read -p "Enter your GitHub username or email: " github_name_email
|
||||||
|
read -p "Enter your GitHub username: " github_username
|
||||||
|
read -p "Enter your GitHub repository name: " github_repo_name
|
||||||
|
|
||||||
|
git log --author="$github_name_email" | grep ^commit | sed "s/commit /https:\/\/github.com\/$github_username\/$github_repo_name\/commit\//"
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>GitHub Commit Fetcher</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="styles.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Fetch GitHub Commits</h1>
|
||||||
|
<div class="container">
|
||||||
|
<div class="input-section">
|
||||||
|
<label for="email">GitHub Username or Email:</label>
|
||||||
|
<input type="text" id="email" placeholder="username or email"><br><br>
|
||||||
|
|
||||||
|
<label for="username">GitHub Username:</label>
|
||||||
|
<input type="text" id="username" placeholder="Username"><br><br>
|
||||||
|
|
||||||
|
<label for="repo">Repository Name:</label>
|
||||||
|
<input type="text" id="repo" placeholder="Repository"><br><br>
|
||||||
|
|
||||||
|
<label for="sinceDate">Commits since:</label>
|
||||||
|
<input type="date" id="sinceDate"><br><br>
|
||||||
|
|
||||||
|
<label for="private">Private Repository?</label>
|
||||||
|
<input type="checkbox" id="private" onchange="toggleTokenInput()"><br><br>
|
||||||
|
|
||||||
|
<div id="tokenDiv" class="hidden">
|
||||||
|
<label for="token">Access Token:</label>
|
||||||
|
<input type="password" id="token" placeholder="GitHub Access Token"><br><br>
|
||||||
|
</div>
|
||||||
|
<button onclick="fetchCommits()">Fetch Commits</button>
|
||||||
|
</div>
|
||||||
|
<div class="commit-section">
|
||||||
|
<h2>Commit Links:</h2>
|
||||||
|
<ul id="commitList">
|
||||||
|
<p>Nothing yet...</p>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="script.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
function toggleTokenInput() {
|
||||||
|
const tokenDiv = document.querySelector('#tokenDiv');
|
||||||
|
if (document.querySelector('#private').checked) {
|
||||||
|
tokenDiv.classList.remove('hidden');
|
||||||
|
} else {
|
||||||
|
tokenDiv.classList.add('hidden');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchCommits() {
|
||||||
|
const email = document.querySelector('#email').value?.trim();
|
||||||
|
const username = document.querySelector('#username').value?.trim();
|
||||||
|
const repo = document.querySelector('#repo').value?.trim();
|
||||||
|
const sinceDate = document.querySelector('#sinceDate').value;
|
||||||
|
const token = document.querySelector('#token').value?.trim();
|
||||||
|
let headers = new Headers();
|
||||||
|
|
||||||
|
if (token) {
|
||||||
|
headers.append('Authorization', `token ${token}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let url = `https://api.github.com/repos/${username}/${repo}/commits?author=${email}`;
|
||||||
|
if (sinceDate) {
|
||||||
|
url += `&since=${sinceDate}T00:00:00Z`; // Assume commits from the beginning of the specified date
|
||||||
|
}
|
||||||
|
|
||||||
|
const commitList = document.querySelector('#commitList');
|
||||||
|
try {
|
||||||
|
const response = await fetch(url, { headers: headers });
|
||||||
|
|
||||||
|
const commits = await response.json();
|
||||||
|
if (commits.message) {
|
||||||
|
return commitList.innerHTML = `ERR: <pre style="display: inline-block; font-size: larger">${commits.message}</pre>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
commitList.innerHTML = '';
|
||||||
|
|
||||||
|
commits.forEach(commit => {
|
||||||
|
const listItem = document.createElement('li');
|
||||||
|
listItem.innerHTML = `<a href="${commit.html_url}" target="_blank">${commit.html_url}</a>`;
|
||||||
|
commitList.appendChild(listItem);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create the copy button
|
||||||
|
const copyButton = document.createElement('button');
|
||||||
|
copyButton.textContent = 'Copy Commits';
|
||||||
|
|
||||||
|
// Add the copy button to the DOM
|
||||||
|
document.querySelector('.commit-section').insertBefore(copyButton, document.querySelector('#commitList'));
|
||||||
|
|
||||||
|
// Add event listener to the copy button
|
||||||
|
copyButton.addEventListener('click', () => {
|
||||||
|
const range = document.createRange();
|
||||||
|
range.selectNode(commitList);
|
||||||
|
const selection = window.getSelection();
|
||||||
|
selection.removeAllRanges();
|
||||||
|
selection.addRange(range);
|
||||||
|
|
||||||
|
try {
|
||||||
|
document.execCommand('copy');
|
||||||
|
alert('Commits copied to clipboard');
|
||||||
|
} catch (err) {
|
||||||
|
alert('Failed to copy commits');
|
||||||
|
}
|
||||||
|
|
||||||
|
selection.removeAllRanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
commitList.innerHTML = `ERR: <pre>${error}</pre>`;
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
+85
@@ -0,0 +1,85 @@
|
|||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #f4f4f9;
|
||||||
|
margin: 20px;
|
||||||
|
padding: 20px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: #0a66c2;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="text"],
|
||||||
|
input[type="password"],
|
||||||
|
input[type="date"] {
|
||||||
|
padding: 8px;
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
width: 300px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background-color: #4CAF50;
|
||||||
|
color: white;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
background-color: #45a049;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #0a66c2;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#commitList {
|
||||||
|
overflow: scroll;
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 30em;
|
||||||
|
border: grey solid 1px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-section {
|
||||||
|
flex: 1 1 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.commit-section {
|
||||||
|
flex: 1 1 300px;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user