diff --git a/.eleventy.js b/.eleventy.js index 52b287a..b1ce611 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -70,6 +70,10 @@ module.exports = function (eleventyConfig) { ); }); + eleventyConfig.addFilter('readableDateFromIso', (dateString) => { + return DateTime.fromJSDate(new Date(dateString)).toFormat('dd LLL yyyy'); + }); + eleventyConfig.addFilter('htmlDateString', (dateObj) => { return DateTime.fromJSDate(dateObj, { zone: 'utc' }).toFormat('yyyy-LL-dd'); }); diff --git a/.github/workflows/repo-data-query.json b/.github/workflows/repo-data-query.json new file mode 100644 index 0000000..3b8f620 --- /dev/null +++ b/.github/workflows/repo-data-query.json @@ -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 } } } } } } }" + } +} diff --git a/.github/workflows/repo-data-response.js b/.github/workflows/repo-data-response.js new file mode 100644 index 0000000..85f71ec --- /dev/null +++ b/.github/workflows/repo-data-response.js @@ -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"); + 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)) + ); + } catch (error) { + console.log("There was an error writing your JSON file:", error); + } +} diff --git a/.github/workflows/repo-data.yml b/.github/workflows/repo-data.yml new file mode 100644 index 0000000..40f094b --- /dev/null +++ b/.github/workflows/repo-data.yml @@ -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 + authorization: "Bearer ${{ secrets.GITHUB_TOKEN }}" + axios_config: .github/workflows/repo-data-query.json + postprocess: .github/workflows/repo-data-response.js diff --git a/.gitignore b/.gitignore index 20276ad..739ee62 100644 --- a/.gitignore +++ b/.gitignore @@ -119,3 +119,4 @@ public .yarn/build-state.yml .yarn/install-state.gz .pnp.* +pancake/sass/pancake.scss diff --git a/src/css/contributor-activity.css b/src/css/contributor-activity.css new file mode 100644 index 0000000..0ca547b --- /dev/null +++ b/src/css/contributor-activity.css @@ -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; +} diff --git a/src/css/main.css b/src/css/main.css index a68996a..6ed63b8 100644 --- a/src/css/main.css +++ b/src/css/main.css @@ -10,6 +10,7 @@ /*@import 'typography.css';*/ @import 'post-list.css'; +@import 'contributor-activity.css'; @import 'hero.css'; @import 'post.css'; diff --git a/src/data/repoData.json b/src/data/repoData.json new file mode 100644 index 0000000..72dc58e --- /dev/null +++ b/src/data/repoData.json @@ -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\ndesignsystem@dta.gov.au.\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\ndesignsystem@dta.gov.au\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":[]}} \ No newline at end of file diff --git a/src/includes/contributor-activity.njk b/src/includes/contributor-activity.njk new file mode 100644 index 0000000..35b88fc --- /dev/null +++ b/src/includes/contributor-activity.njk @@ -0,0 +1,29 @@ +
+ {{ issue.title }}
+ #{{ issue.number }} created on {{ issue.createdAt | readableDateFromIso }}, updated {{ pullRequest.updatedAt | readableDateFromIso }}
+
+ {{ pullRequest.title }}
+ #{{ pullRequest.number }} created on {{ pullRequest.createdAt | readableDateFromIso }}, updated {{ pullRequest.updatedAt | readableDateFromIso }}
+