Post

How to use jq as professional

How to use jq as PRO

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
curl -s \
      --header "Authorization: Bearer $TOKEN" \
      --header "Content-Type: application/vnd.api+json" \
      --request GET ${URL}  | jq -r '(.included |
  map({(.id): .}) | add) as $inc |
  .data[] | {"run-id": .id} +
  ($inc[$inc[.relationships."configuration-version".data.id].relationships."ingress-attributes".data.id].attributes |
  {
    branch,
    "commit-message",
    "sender-username",
    "clone-url",
    "commit-url",
    "compare-url",
    identifier
  }) +
  (.attributes."status-timestamps"|
    {
      "applied-at",
      "planned-at",
      "queuing-at",
      "applying-at",
      "planning-at",
      "confirmed-at",
      "plan-queued-at",
      "apply-queued-at",
      "queuing-apply-at",
      "plan-queueable-at",

    }
  ) + (.attributes |
    {
      "trigger-reason"

    }
  )
  '

This post is licensed under CC BY 4.0 by the author.