Skip to content

Instantly share code, notes, and snippets.

@zacharysyoung
Created January 3, 2023 01:52
Show Gist options
  • Save zacharysyoung/7b573dc0bc250b26e933894ec9f52be1 to your computer and use it in GitHub Desktop.
Save zacharysyoung/7b573dc0bc250b26e933894ec9f52be1 to your computer and use it in GitHub Desktop.
Get forks JQ
# $ageThresholdInSeconds passed in from command-line, like `jq --arg ageThresholdInSeconds 10 -f <this-file>`
def selectOnlyModifiedForks:
((.updated_at | fromdate) - (.created_at | fromdate)) as $ageDiffInSeconds
| select(
$ageDiffInSeconds > ($ageThresholdInSeconds | tonumber)
)
;
[
.[]
| selectOnlyModifiedForks
| {
html_url: .html_url,
created_at: .created_at,
updated_at: .updated_at
}
]
| sort_by(.updated_at)
| reverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment