Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
bf6697b
add workflow action
Aug 11, 2021
0778a30
add template for issues list
Aug 11, 2021
2e05dad
git shenannigans
Aug 11, 2021
f2d295a
Flat: latest data (2021-08-11T01:02:49.166Z)
flat-data Aug 11, 2021
2d19d52
add response processing
petronbot Aug 11, 2021
a58e3c5
i guess no subfolders in the workflows folder
petronbot Aug 11, 2021
e23c3d2
Flat: latest data (2021-08-11T01:27:24.536Z)
flat-data Aug 11, 2021
9e764b6
i guess no subfolders in the workflows folder
petronbot Aug 11, 2021
9066b90
Flat: latest data (2021-08-11T01:33:23.386Z)
flat-data Aug 11, 2021
bf87745
fiddle with the axios config
petronbot Aug 12, 2021
c61d87a
ignore pancake generated sass file
petronbot Aug 12, 2021
6b2fc65
remove dodgy Deno import
petronbot Aug 12, 2021
fd869f5
lol I'm so gonna squash this PR
petronbot Aug 12, 2021
38d8d00
what's deno anyway
petronbot Aug 12, 2021
8f6cebe
deno api changes
petronbot Aug 12, 2021
30387d4
oops
petronbot Aug 12, 2021
ec2df3e
i'm outta practice
petronbot Aug 12, 2021
f58d989
ok
petronbot Aug 12, 2021
edc9f0f
lol
petronbot Aug 12, 2021
4958658
jfc
petronbot Aug 12, 2021
380006b
debuggin postprocessing
petronbot Aug 12, 2021
3a2587e
save data file outside actions dir
petronbot Aug 12, 2021
1f7e1fb
Flat: latest data (2021-08-12T01:55:25.200Z)
flat-data Aug 12, 2021
60612c6
update postprocess file ref
petronbot Aug 12, 2021
22cd1e5
Flat: latest data (2021-08-12T01:57:59.047Z)
flat-data Aug 12, 2021
08c7fec
got it together
petronbot Aug 12, 2021
ea2b683
add new date filter
petronbot Aug 12, 2021
f761444
Flat: latest data (2021-08-12T04:26:48.863Z)
flat-data Aug 12, 2021
1096de7
fix typo
petronbot Aug 12, 2021
64c377f
line ending
petronbot Aug 12, 2021
25dfcae
apostrphes
petronbot Aug 12, 2021
0809094
remove unused data file
petronbot Aug 12, 2021
d8effb0
line ending
petronbot Aug 12, 2021
4ac008a
name change
petronbot Aug 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/repo-data-postprocess.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { readJSON, writeJSON } from "https://deno.land/x/[email protected]/mod.ts";

try {
const json = await readJSON(".github/workflows/repo-data-response.json");
} catch (error) {
console.log("There was an error parsing the JSON response:", error);
}

if (json?.errors.length) {
console.log(
"There was an error response from the API:",
JSON.stringify(json.errors)
);
} else {
try {
await writeJSON("src/data/repo-data.json");
} catch (error) {
console.log("There was an error writing your JSON file:", error);
}
}
6 changes: 6 additions & 0 deletions .github/workflows/repo-data-query.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we format this file at all?

"method": "post",
"data": {
"query": "query { repository(owner: \"designsystemau\", name: \"blog-site\") {\n name\n codeOfConduct {\n body\n }\n issues(first: 20) {\n totalCount\n nodes {\n id\n url\n number\n lastEditedAt\n createdAt\n title\n bodyHTML\n participants(first: 20) {\n totalCount\n nodes {\n id\n url\n name\n avatarUrl\n }\n }\n comments(first: 1) {\n totalCount\n nodes {\n id\n url\n lastEditedAt\n createdAt\n bodyHTML\n author {\n url\n avatarUrl\n login\n }\n }\n }\n }\n }\n pullRequests(first: 20) {\n totalCount\n nodes {\n id\n permalink\n title\n participants(first: 20) {\n totalCount\n nodes {\n id\n url\n name\n avatarUrl\n }\n }\n comments(first: 1) {\n totalCount\n nodes {\n id\n url\n lastEditedAt\n createdAt\n bodyHTML\n author {\n url\n avatarUrl\n login\n }\n }\n }\n }\n }\n }\n}"
}
}
38 changes: 38 additions & 0 deletions .github/workflows/repo-data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: repo-data
on:
workflow_dispatch: {}
push:
branches:
- main
pull_request:
branches:
- main
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- name: Setup deno
uses: denoland/setup-deno@main
with:
deno-version: v1.x
- name: Check out repo (pull request)
uses: actions/checkout@v2
if: github.event_name == 'pull_request'
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}

- name: Check out repo (push)
uses: actions/checkout@v2
if: github.event_name == 'push'
with:
fetch-depth: 0

- name: Fetch data
uses: githubocto/flat@v3
with:
http_url: https://api.github.com/graphql
downloaded_filename: .github/workflows/repo-data-response.json
authorization: "Bearer ${{ secrets.GITHUB_TOKEN }}"
axios_config: .github/workflows/repo-data-query.json
postprocess: .github/workflows/repo-data-response.js
1 change: 1 addition & 0 deletions src/data/repo-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"errors":[{"message":"Parse error on \"query\" (STRING) at [1, 2]","locations":[{"line":1,"column":2}]}]}
5 changes: 5 additions & 0 deletions src/includes/issues-list.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<pre>
{% for issue in data.repository.issues %}
{{ JSON.stringify(issue, null, 2) | safe }}
{% endfor %}
</pre>