Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.6 KiB

  1. #!/bin/bash
  2. # I don't know how to jq.
  3. #
  4. # The idea here is a rough guess at patches merged since start of the Wikimedia
  5. # Hackathon 2024.
  6. #
  7. # References:
  8. #
  9. # - https://gerrit.wikimedia.org/r/q/status:merged+mergedafter:%222024-05-03+00:00:00+%252B0300%22,50
  10. # - https://stackoverflow.com/questions/44497533/jq-transform-unix-timestamp-to-datetime
  11. # - Pretty sure date results here will be UTC
  12. # Get a list of patches since midnight May 3rd in Tallinn. This doesn't
  13. # account for pagination, so check that if you run again. I think I used
  14. # gerrit-query here instead of curling to the API so as not have to
  15. # cross-reference numeric user IDs.
  16. ssh -p 29418 gerrit.wikimedia.org gerrit query --format json --submit-records status:merged 'mergedafter:{2024-05-03 00:00:00 +0300}' > results.json
  17. # Trim trailing line with summary:
  18. sed -i '$ d' results.json
  19. # Dates are unix timestamps - get human readable ones:
  20. jq '.createdOn |= todateiso8601 | .lastUpdated |= todateiso8601' results.json > results_filtered.json
  21. # Pull out relevant fields. Assumptions include that the submitter will be the
  22. # first thing in submitRecords, which honestly I have no idea if that holds.
  23. #
  24. # There's also an @tsv available in jq, but on the version I was running it
  25. # produces quoted strings per-row with \t escapes instead of an actual TSV,
  26. # which is... Not actually TSV.
  27. jq '[
  28. .project,
  29. .url,
  30. .subject,
  31. .owner.name,
  32. .owner.email,
  33. .submitRecords[0].labels[1].by.name,
  34. .submitRecords[0].labels[1].by.email,
  35. .createdOn,
  36. .lastUpdated
  37. ] | @csv' \
  38. results_filtered.json > results.csv