-
-
Notifications
You must be signed in to change notification settings - Fork 130
Json backlog testing #1878
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
base: main
Are you sure you want to change the base?
Json backlog testing #1878
Changes from all commits
4f8ffcf
8f00079
7bfcf63
8638330
326c849
b221dbf
799a342
bf75b65
56c9c25
17949f2
f75dbc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,69 +1,31 @@ | ||
| {{/* This uses graphQL instead of REST | ||
| It returns a map of "blocks" so issues can be passed into the blocks loop instead of needing its own system | ||
| If we decide we like this better, we should probably systematise this and store | ||
| the graphql queries in their own dir | ||
| https://docs.github.com/en/graphql/reference/objects#issue | ||
| This exact matches on labels unlike the current system which partial matches inside Hugo | ||
| We did that because PD kept making partially matching labels, but maybe we should be stricter | ||
| TODO But it means someone has to go round and clean up | ||
| {{/* | ||
| Loading backlog issues from static JSON | ||
|
|
||
| - $courseRegex matches the course name from the url. | ||
| - $courseName strips the leading/trailing / characters TODO: This could probably be avoided with a better regex | ||
| - $issuesForModule filters by module name and returns the first element from the resulting array. | ||
| - $IssuesForSprint filters those issues by sprint label | ||
|
|
||
| */}} | ||
| {{ $repo := .backlog }} | ||
| {{ $variables := dict | ||
| "owner" site.Params.owner | ||
| "repo" $repo | ||
| }} | ||
| {{ $currentPath := .path }} | ||
| {{ if .backlog_filter }} | ||
| {{ $variables = merge $variables (dict "labels" .backlog_filter) }} | ||
|
|
||
| {{ $courseRegex := `/(.*?)/` }} | ||
| {{ $courseName := (trim (index (findRE $courseRegex .path 1) 0) "/") }} | ||
|
Comment on lines
+11
to
+12
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
| {{ $foundIssues := slice}} | ||
| {{ $issuesForModule := slice}} | ||
| {{ $issuesForSprint := slice}} | ||
|
|
||
| {{ $courseIssues := index site.Data.backlog.courses $courseName}} | ||
|
|
||
| {{ if $courseIssues.modules }} | ||
| {{ $issuesForModule = index (where $courseIssues.modules "name" .backlog) 0}} | ||
| {{end}} | ||
|
|
||
| {{ if $issuesForModule }} | ||
| {{ $issuesForSprint = where $issuesForModule.sprints "name" .backlog_filter }} | ||
| {{ end }} | ||
| <!--prettier-ignore--> | ||
| {{ $query := `query($owner: String!, $repo: String!, $labels: [String!]) { | ||
| repository(owner: $owner, name: $repo) { | ||
| issues( | ||
| last: 100, | ||
| filterBy: { | ||
| states: OPEN, | ||
| labels: $labels | ||
| } | ||
| ) { | ||
| nodes { | ||
| title | ||
| url | ||
| number | ||
| labels( | ||
| first: 50 | ||
| orderBy: { | ||
| direction: DESC | ||
| field: NAME | ||
| } | ||
| ) { | ||
| nodes { | ||
| name | ||
| color | ||
| description | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }` }} | ||
|
|
||
| {{ $request := dict | ||
| "method" "POST" | ||
| "body" (dict "query" $query "variables" $variables | jsonify) | ||
| }} | ||
| {{ $issueBlocks := slice }} | ||
| {{ with resources.GetRemote "https://api.github.com/graphql" (merge $request (partial "github-auth.html" .)) }} | ||
| {{ with .Content | unmarshal }} | ||
| {{ if not .data.repository }} | ||
| {{ errorf "GitHub repository %s/%s referenced on %s had no issues" site.Params.owner (index $variables "repo") $currentPath }} | ||
| {{ else }} | ||
| {{ with .data.repository.issues.nodes }} | ||
| {{ range sort . "title" "asc" }} | ||
| {{ $issueBlocks = $issueBlocks | append (dict "name" .title "src" .url "number" .number "labels" .labels "repo" $repo) }} | ||
| {{ end }} | ||
| {{ end }} | ||
| {{ end }} | ||
| {{ end }} | ||
| {{ if $issuesForSprint }} | ||
| {{ $foundIssues = (index $issuesForSprint 0).backlog_tasks}} | ||
| {{ end }} | ||
| {{ return $issueBlocks }} | ||
|
|
||
| {{ return $foundIssues }} | ||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great for testing partial progress, but let's turn it into an error before merging