commit 134fc75bd8d7bc5f2ff4bf7151bf56670c314199 Author: ION606 Date: Mon Jun 24 17:59:32 2024 -0400 initial commit diff --git a/getCommits.sh b/getCommits.sh new file mode 100644 index 0000000..71f2dc0 --- /dev/null +++ b/getCommits.sh @@ -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\//" \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..91af845 --- /dev/null +++ b/index.html @@ -0,0 +1,47 @@ + + + + + + + GitHub Commit Fetcher + + + + +

Fetch GitHub Commits

+
+
+ +

+ + +

+ + +

+ + +

+ + +

+ + + +
+
+

Commit Links:

+
    +

    Nothing yet...

    +
+
+
+ + + + + \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..ec8f173 --- /dev/null +++ b/script.js @@ -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:
${commits.message}
`; + } + + commitList.innerHTML = ''; + + commits.forEach(commit => { + const listItem = document.createElement('li'); + listItem.innerHTML = `${commit.html_url}`; + 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:
${error}
`; + console.error(error); + } +} \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..b193598 --- /dev/null +++ b/styles.css @@ -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; +} \ No newline at end of file