Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Pull Request): Additions and Deletions #400

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

NickHackman
Copy link

@NickHackman NickHackman commented Dec 10, 2024

This PR adds 2 new fields to a Pull Requests of Additions and Deletions

docs: https://docs.github.com/en/graphql/reference/objects#pullrequest

Use Cases

  • Determining code churn
  • Determining PR size and helping promote better PR practices by keeping PR size small

@CLAassistant
Copy link

CLAassistant commented Dec 10, 2024

CLA assistant check
All committers have signed the CLA.

@NickHackman NickHackman marked this pull request as ready for review December 10, 2024 21:17
@NickHackman NickHackman requested a review from a team as a code owner December 10, 2024 21:17
@NickHackman NickHackman force-pushed the pr-add-additions-and-deletions branch from 93c1675 to 7ffb8ac Compare December 10, 2024 21:24
@NickHackman NickHackman force-pushed the pr-add-additions-and-deletions branch from 9a9bf4b to fee59e6 Compare December 10, 2024 21:28
@NickHackman NickHackman changed the title Pull Request: Additions and Deletions feat(Pull Request): Additions and Deletions Dec 11, 2024
@NickHackman
Copy link
Author

Additions/Deletions by Day

Screenshot 2024-12-13 at 10 16 19 AM

Panel JSON
{
  "datasource": {
    "uid": "ae6qd8evnl1xcd",
    "type": "grafana-github-datasource"
  },
  "type": "barchart",
  "title": "Additions and Deletions",
  "gridPos": {
    "x": 0,
    "y": 0,
    "w": 12,
    "h": 8
  },
  "id": 3,
  "targets": [
    {
      "datasource": {
        "type": "grafana-github-datasource",
        "uid": "ae6qd8evnl1xcd"
      },
      "refId": "A",
      "queryType": "Pull_Requests",
      "owner": "grafana",
      "options": {
        "query": "is:merged archived:false",
        "timeField": 2
      }
    }
  ],
  "options": {
    "orientation": "auto",
    "xTickLabelRotation": 0,
    "xTickLabelSpacing": 0,
    "showValue": "auto",
    "stacking": "normal",
    "groupWidth": 0.7,
    "barWidth": 0.97,
    "barRadius": 0,
    "fullHighlight": false,
    "tooltip": {
      "mode": "single",
      "sort": "none"
    },
    "legend": {
      "showLegend": true,
      "displayMode": "list",
      "placement": "bottom",
      "calcs": []
    }
  },
  "transformations": [
    {
      "id": "convertFieldType",
      "options": {
        "fields": {},
        "conversions": [
          {
            "targetField": "merged_at",
            "destinationType": "string",
            "dateFormat": "YYYY-MM-DD"
          }
        ]
      }
    },
    {
      "id": "sortBy",
      "options": {
        "fields": {},
        "sort": [
          {
            "field": "merged_at"
          }
        ]
      }
    },
    {
      "id": "groupBy",
      "options": {
        "fields": {
          "merged_at": {
            "aggregations": [],
            "operation": "groupby"
          },
          "additions": {
            "aggregations": [
              "sum"
            ],
            "operation": "aggregate"
          },
          "deletions": {
            "aggregations": [
              "sum"
            ],
            "operation": "aggregate"
          }
        }
      }
    },
    {
      "id": "organize",
      "options": {
        "excludeByName": {},
        "indexByName": {},
        "renameByName": {
          "additions (sum)": "Additions",
          "deletions (sum)": "Deletions"
        },
        "includeByName": {}
      }
    }
  ],
  "fieldConfig": {
    "defaults": {
      "custom": {
        "lineWidth": 1,
        "fillOpacity": 80,
        "gradientMode": "none",
        "axisPlacement": "auto",
        "axisLabel": "Additions/Deletions",
        "axisColorMode": "text",
        "axisBorderShow": false,
        "scaleDistribution": {
          "type": "linear"
        },
        "axisCenteredZero": false,
        "hideFrom": {
          "tooltip": false,
          "viz": false,
          "legend": false
        },
        "thresholdsStyle": {
          "mode": "off"
        },
        "axisSoftMin": 0
      },
      "color": {
        "mode": "palette-classic"
      },
      "mappings": [],
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "value": null,
            "color": "green"
          },
          {
            "value": 80,
            "color": "red"
          }
        ]
      }
    },
    "overrides": [
      {
        "matcher": {
          "id": "byName",
          "options": "Deletions"
        },
        "properties": [
          {
            "id": "color",
            "value": {
              "mode": "fixed",
              "fixedColor": "red"
            }
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "Additions"
        },
        "properties": [
          {
            "id": "color",
            "value": {
              "mode": "fixed",
              "fixedColor": "green"
            }
          }
        ]
      }
    ]
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants