Skip to content

Instantly share code, notes, and snippets.

@0xPoe
Created September 16, 2023 16:00
Show Gist options
  • Select an option

  • Save 0xPoe/2feabf48cee1d5571bca59c819ed8af6 to your computer and use it in GitHub Desktop.

Select an option

Save 0xPoe/2feabf48cee1d5571bca59c819ed8af6 to your computer and use it in GitHub Desktop.
Get your commits
#!/bin/bash
# Set the repository and path variables
repository="pingcap/tidb"
path="statistics"
since_date="2023-09-09T00:00:00Z"
# Construct the GitHub API URL
api_url="https://api.github.com/repos/$repository/commits?path=$path&since=$since_date"
# Send a GET request to the GitHub API and store the response in a variable
response=$(curl -s "$api_url")
# Use jq to extract PR numbers and GitHub links from the commit data
pr_info=$(echo "$response" | jq -r '.[] | "\(.html_url) \(.commit.url | split("/")[-4])"')
# Print the PR numbers and GitHub links
echo "PR numbers and their GitHub links:"
echo "$pr_info"
~
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment