-
Notifications
You must be signed in to change notification settings - Fork 0
Action to fetch repo data for publishing to the blog #3
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?
Changes from all commits
bf6697b
0778a30
2e05dad
f2d295a
2d19d52
a58e3c5
e23c3d2
9e764b6
9066b90
bf87745
c61d87a
6b2fc65
fd869f5
38d8d00
8f6cebe
30387d4
ec2df3e
f58d989
edc9f0f
4958658
380006b
3a2587e
1f7e1fb
60612c6
22cd1e5
08c7fec
ea2b683
f761444
1096de7
64c377f
25dfcae
0809094
d8effb0
4ac008a
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"method": "post", | ||
"data": { | ||
"query": "{ repository(owner: \"designsystemau\", name: \"design-system-components\") { name url codeOfConduct { body } issues(first: 20, orderBy: {field: UPDATED_AT, direction: DESC}) { totalCount nodes { id url number state updatedAt createdAt title bodyHTML participants(first: 20) { totalCount nodes { id url name avatarUrl } } comments(first: 1) { totalCount nodes { id url updatedAt createdAt bodyHTML author { url avatarUrl login } } } } } pullRequests(first: 20, orderBy: {field: UPDATED_AT, direction: DESC}) { totalCount nodes { id number number createdAt permalink state title participants(first: 20) { totalCount nodes { id url name avatarUrl } } comments(first: 1) { totalCount nodes { id url createdAt bodyHTML author { url avatarUrl login } } } } } } }" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const decoder = new TextDecoder("utf-8"); | ||
const encoder = new TextEncoder(); | ||
|
||
let json; | ||
let response; | ||
|
||
try { | ||
json = await Deno.readFile("src/data/repoData.json"); | ||
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. Is there an advantage to using Deno here? |
||
response = JSON.parse(decoder.decode(json)); | ||
} catch (error) { | ||
console.log("There was an error parsing the JSON response:", error); | ||
} | ||
|
||
if (response?.errors?.length) { | ||
console.log( | ||
"There was an error response from the API:", | ||
JSON.stringify(response.errors) | ||
); | ||
} else { | ||
try { | ||
await Deno.writeFile( | ||
"src/data/repoData.json", | ||
encoder.encode(JSON.stringify(response.data.repository)) | ||
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. Optional, but for it to remain clear that this file is generated, you could prepend a comment at the top of file? maybe it would also include the generated date. |
||
); | ||
} catch (error) { | ||
console.log("There was an error writing your JSON file:", error); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: "Fetch 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: src/data/repoData.json | ||
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 propose renaming this to repo.json |
||
authorization: "Bearer ${{ secrets.GITHUB_TOKEN }}" | ||
axios_config: .github/workflows/repo-data-query.json | ||
postprocess: .github/workflows/repo-data-response.js |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,3 +119,4 @@ public | |
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
pancake/sass/pancake.scss |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.contributor-activity__wrapper { | ||
padding-top: 2rem; | ||
} | ||
|
||
.contributor-activity__list { | ||
list-style: none; | ||
padding-inline-start: 0; | ||
} | ||
|
||
.contributor-activity__list-item { | ||
border-bottom: 1px solid #e6e6e6; | ||
padding: 1rem 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"design-system-components","url":"https://github.com/designsystemau/design-system-components","codeOfConduct":{"body":"# Code of Conduct\n\n## 1. Purpose\n\nA primary goal of the design system components is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are\ncommitted to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status,\nand religion (or lack thereof).\n\nThis code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior.\n\nWe invite all those who participate and contribute to the design system components to help us create safe and positive experiences for everyone.\n\n## 2. Open Source Citizenship\n\nA supplemental goal of this Code of Conduct is to increase open source citizenship by encouraging participants to recognize and strengthen the relationships\nbetween our actions and their effects on our community.\n\nCommunities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist\nin society.\n\nIf you see someone who is making an extra effort to ensure our community is welcoming, friendly, and encourages all participants to contribute to the fullest\nextent, we want to know.\n\n## 3. Expected Behavior\n\nThe following behaviors are expected and requested of all community members:\n\n* Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community.\n* Exercise consideration and respect in your speech and actions.\n* Attempt collaboration before conflict.\n* Refrain from demeaning, discriminatory, or harassing behavior and speech.\n* Be mindful of your surroundings and of your fellow participants. Alert community leaders if you notice a dangerous situation, someone in distress, or\n violations of this Code of Conduct, even if they seem inconsequential.\n* Remember that community event venues may be shared with members of the public; please be respectful to all patrons of these locations.\n\n## 4. Unacceptable Behavior\n\nThe following behaviors are considered harassment and are unacceptable within our community:\n\n* Violence, threats of violence or violent language directed against another person.\n* Sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory jokes and language.\n* Posting or displaying sexually explicit or violent material.\n* Posting or threatening to post other people’s personally identifying information (\"doxing\").\n* Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability.\n* Inappropriate photography or recording.\n* Inappropriate physical contact. You should have someone’s consent before touching them.\n* Unwelcome sexual attention. This includes, sexualized comments or jokes; inappropriate touching, groping, and unwelcomed sexual advances.\n* Deliberate intimidation, stalking or following (online or in person).\n* Advocating for, or encouraging, any of the above behavior.\n* Sustained disruption of community events, including talks and presentations.\n\n## 5. Consequences of Unacceptable Behavior\n\nUnacceptable behavior from any community member, including sponsors and those with decision-making authority, will not be tolerated.\n\nAnyone asked to stop unacceptable behavior is expected to comply immediately.\n\nIf a community member engages in unacceptable behavior, the community organizers may take any action they deem appropriate, up to and including a temporary ban\nor permanent expulsion from the community without warning (and without refund in the case of a paid event).\n\n## 6. Reporting Guidelines\n\nIf you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible via\[email protected].\n\nAdditionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing\nunacceptable behavior feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress.\n\n## 7. Addressing Grievances\n\nIf you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify the design system team with a concise description of your\ngrievance. Your grievance will be handled in accordance with our existing governing policies.\n\n## 8. Scope\n\nWe expect all community participants (contributors, paid or otherwise; sponsors; and other guests) to abide by this Code of Conduct in all community\nvenues–online and in-person–as well as in all one-on-one communications pertaining to community business.\n\nThis code of conduct and its related procedures also applies to unacceptable behavior occurring outside the scope of community activities when such behavior has\nthe potential to adversely affect the safety and well-being of community members.\n\n## 9. Contact info\n\[email protected]\n\n## 10. License and attribution\n\nThis Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/).\n\nPortions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment\nPolicy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).\n\nRetrieved on November 22, 2016 from [http://citizencodeofconduct.org/](http://citizencodeofconduct.org/)\n"},"issues":{"totalCount":0,"nodes":[]},"pullRequests":{"totalCount":0,"nodes":[]}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<h3 class="au-display-lg">Recent contributor activity on <a href="{{ repoData.url }}">{{ repoData.name }}</a></h1> | ||
<div class="contributor-activity__wrapper"> | ||
<h4 class="au-display-md">Latest issue updates</h4> | ||
<ul class="contributor-activity__list"> | ||
{% for issue in repoData.issues.nodes %} | ||
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. Does this list need limiting? |
||
<li class="contributor-activity__list-item"> | ||
<p> | ||
<strong>{{ issue.title }}</strong><br /> | ||
<a href="{{ issue.url }}">#{{ issue.number }}</a> created on {{ issue.createdAt | readableDateFromIso }}, updated {{ pullRequest.updatedAt | readableDateFromIso }} | ||
</p> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
<p><a href="">View all open issues</a></p> | ||
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. Missing an href value here and in corresponding one below. |
||
</div> | ||
<div class="contributor-activity__wrapper"> | ||
<h4 class="au-display-md">Latest pull request updates</h4> | ||
<ul class="contributor-activity__list"> | ||
{% for pullRequest in repoData.pullRequests.nodes %} | ||
<li class="contributor-activity__list-item"> | ||
<p> | ||
<strong>{{ pullRequest.title }}</strong><br /> | ||
<a href="{{ pullRequest.url }}">#{{ pullRequest.number }}</a> created on {{ pullRequest.createdAt | readableDateFromIso }}, updated {{ pullRequest.updatedAt | readableDateFromIso }} | ||
</p> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
<p><a href="">View all pull requests</a></p> | ||
</div> |
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.
can we format this file at all?