From 1a5e8b1e590dd3171ba09dbc439dbd3cdcdc6fe2 Mon Sep 17 00:00:00 2001 From: kenlhlui <116421546+kenlhlui@users.noreply.github.com> Date: Fri, 14 Nov 2025 14:42:41 -0500 Subject: [PATCH 1/4] feat: added the automated ci generated date to the page footer --- .github/workflows/ci_pr.yml | 62 ++++++++++++++++++++++++++++++++++++ _config.yml | 15 ++++----- _includes/footer_custom.html | 3 +- docs/children.md | 3 +- docs/children_2.md | 3 +- docs/index.md | 3 +- docs/sink.md | 2 +- docs/table.md | 3 +- 8 files changed, 80 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/ci_pr.yml diff --git a/.github/workflows/ci_pr.yml b/.github/workflows/ci_pr.yml new file mode 100644 index 0000000..b15d356 --- /dev/null +++ b/.github/workflows/ci_pr.yml @@ -0,0 +1,62 @@ +name: CI Pipeline for Pull Requests + +on: + pull_request: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: write + +jobs: + # Auto-generate date job to update _config.yml + auto-gen-date: + name: Update ci_last_modified_date in _config.yml + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v5 + with: + ref: ${{ github.head_ref }} + persist-credentials: true + fetch-depth: 0 + + - name: Set date + id: set_date + run: | + date_value=$(date +'%Y-%m-%d') + echo "date_yyyy_mm_dd=$date_value" >> $GITHUB_ENV + echo "date=$date_value" >> $GITHUB_OUTPUT + + - name: Update _config.yml + uses: mikefarah/yq@master + with: + cmd: yq -i '.ci_last_modified_date = "${{ steps.set_date.outputs.date }}"' _config.yml + + - name: Commit and Push + uses: stefanzweifel/git-auto-commit-action@v7 + with: + commit_message: "ci: Auto-update date to ${{ steps.set_date.outputs.date }}" + file_pattern: "_config.yml" + + # YAML Lint job - runs after auto-gen-date + yamllint: + name: Lint YAML files + runs-on: ubuntu-latest + needs: auto-gen-date + steps: + - name: Checkout + uses: actions/checkout@v5 + with: + ref: ${{ github.head_ref }} + + - name: Install yamllint + run: python3 -m pip install yamllint + + - name: Lint YAML files + run: "yamllint -f github -d '{extends: default, rules: {line-length: disable}}' _data/guides.yml" \ No newline at end of file diff --git a/_config.yml b/_config.yml index 4baa899..1943479 100644 --- a/_config.yml +++ b/_config.yml @@ -1,7 +1,7 @@ ## Site settings title: "Map & Data Library just the Docs Theme" description: "Workshops and guides from the Map & Data Library, University of Toronto" -url: "https://MDLutoronto.github.io/jtd-theme" # change the slug to the repo's name ('jtd-theme' in this case) +url: "https://MDLutoronto.github.io/jtd-theme" # change the slug to the repo's name ('jtd-theme' in this case) repository: "MDLutoronto/jtd-theme" # for github-metadata ## Navigation footer logos and links @@ -12,7 +12,6 @@ nav_footer_logo_bottom_href: "https://library.utoronto.ca/" nav_footer_logo_top: "/assets/images/mdl_full_logo.png" nav_footer_logo_top_href: "https://mdl.library.utoronto.ca/" - ## License information ## If left empty, a default Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license will be used license_name: "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International" @@ -24,8 +23,8 @@ license_image_url: "https://mirrors.creativecommons.org/presskit/buttons/88x31/s # aux_links: # "Map & Data Library": # - "https://mdl.library.utoronto.ca/" - # "U of T Libraries": - # - "https://library.utoronto.ca/" +# "U of T Libraries": +# - "https://library.utoronto.ca/" ## Workshop series name to be displayed in the footer (optional) # workshop_series_name: "Map & Data Library Workshop Series" @@ -42,7 +41,7 @@ license_image_url: "https://mirrors.creativecommons.org/presskit/buttons/88x31/s baseurl: "" # the subpath of your site, e.g. /blog # Link for the site title in the sidebar; set to "/" for homepage -title_link: "https://mdlutoronto.github.io/tutorials-search/" +title_link: "https://mdlutoronto.github.io/tutorials-search/" # # Makes Aux links open in a new tab. Default is false aux_links_new_tab: true @@ -160,7 +159,6 @@ nav_enabled: true # nav_sort: case_insensitive # default, equivalent to nil nav_sort: case_sensitive # Capital letters sorted before lowercase - # Show navigation error report nav_error_report: true # default is false/nil. @@ -178,7 +176,6 @@ back_to_top_text: "Back to top" # Footer last edited timestamp last_edit_timestamp: false # Keep this be `false`, since it's set inside the footer_custom.html ; use `last_modified_date` in the page's front matter instead - # # Footer "Edit this page on GitHub" link text # gh_edit_link: true # show or hide edit this page link # gh_edit_link_text: "Edit this page on GitHub" @@ -235,4 +232,6 @@ compress_html: sass: quiet_deps: true # https://github.com/just-the-docs/just-the-docs/issues/1541 - silence_deprecations: ['import'] # https://github.com/just-the-docs/just-the-docs/issues/1607 + silence_deprecations: ["import"] # https://github.com/just-the-docs/just-the-docs/issues/1607 + +ci_last_modified_date: "" # automatically updated by GitHub Actions workflow ci_pr.yml. The format is 'YYYY-MM-DD'. diff --git a/_includes/footer_custom.html b/_includes/footer_custom.html index 08eff96..44c3f54 100644 --- a/_includes/footer_custom.html +++ b/_includes/footer_custom.html @@ -1,7 +1,8 @@ {%- if site.footer_content -%}
{{ site.footer_content }}
{%- else -%} -{%- if page.created_date and page.created_date != '' -%}Content created: {{ page.created_date | date: "%B %d, %Y" }}{%- endif -%}{%- if page.created_date and page.created_date != '' and page.last_modified_date and page.last_modified_date != '' -%} | {%- endif -%}{%- if page.last_modified_date and page.last_modified_date != '' -%}Last updated: {{ page.last_modified_date | date: "%B %d, %Y" }}{%- endif -%} +{%- if page.created_date and page.created_date != '' -%}First created: {{ page.created_date | date: "%B %d, %Y" }}{% endif -%} +This workshop is part of the {{ site.workshop_series_name }}
{%- endif -%} diff --git a/docs/children.md b/docs/children.md index c68a4a0..1a839ab 100644 --- a/docs/children.md +++ b/docs/children.md @@ -3,7 +3,8 @@ title: children layout: page nav_order: 1 description: -last_modified_date: 2025-10-06 +created_date: +# last_modified_date: # Only use it when you want to override the auto-updated date. parent: Home --- This is the First Children page! \ No newline at end of file diff --git a/docs/children_2.md b/docs/children_2.md index 47a57df..838f00a 100644 --- a/docs/children_2.md +++ b/docs/children_2.md @@ -3,7 +3,8 @@ title: children 2 layout: page nav_order: 2 description: -last_modified_date: 2025-10-06 +created_date: +# last_modified_date: # Only use it when you want to override the auto-updated date. parent: Home --- This is the Children 2 page! \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 5152b57..8b94a99 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,7 +4,8 @@ layout: home nav_order: 1 description: permalink: / -last_modified_date: 2025-10-06 +created_date: +# last_modified_date: # Only use it when you want to override the auto-updated date. has_children: true --- diff --git a/docs/sink.md b/docs/sink.md index 28c5651..2beeea6 100644 --- a/docs/sink.md +++ b/docs/sink.md @@ -3,7 +3,7 @@ title: Sink layout: page nav_order: 2 description: -last_modified_date: 2025-10-06 +# last_modified_date: # Only use it when you want to override the auto-updated date. created_date: 2024-10-01 parent: Home staff_name: Ken Lui diff --git a/docs/table.md b/docs/table.md index e36c2e7..155bfa4 100644 --- a/docs/table.md +++ b/docs/table.md @@ -3,7 +3,8 @@ title: Rendering Tables from CSV layout: page nav_order: 2 description: How to render tables from CSV files in Jekyll -last_modified_date: 2025-10-14 +created_date: +# last_modified_date: # Only use it when you want to override the auto-updated date. parent: Home --- # Table of Contents From 3df779950364dd577f3752d1d9b34e684dbc25f0 Mon Sep 17 00:00:00 2001 From: kenlhlui <116421546+kenlhlui@users.noreply.github.com> Date: Fri, 14 Nov 2025 16:28:00 -0500 Subject: [PATCH 2/4] ci: added ci ruleset json and README --- .rulesets/README.md | 26 ++++++++++++++++++++++++++ .rulesets/ci.json | 31 +++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 .rulesets/README.md create mode 100644 .rulesets/ci.json diff --git a/.rulesets/README.md b/.rulesets/README.md new file mode 100644 index 0000000..542149a --- /dev/null +++ b/.rulesets/README.md @@ -0,0 +1,26 @@ +# Add ruleset(s) using CLI + +## Prerequisite +You need to have [GitHub CLI](https://cli.github.com/) installed and authenticated. + + +## Command to add ruleset +Replace the `$REPONAME` with your repository name, and the file name (`$FILENAME`) of the ruleset JSON file, then run the following command in your terminal: + +```bash +gh api -X POST /repos/mdlutoronto/$REPONAME/rulesets --input .rulesets/$FILENAME.json +``` + +For example, to add the `ci` ruleset to the `jtd-theme` repository, you would run: + +```bash +gh api -X POST /repos/mdlutoronto/jtd-theme/rulesets --input .rulesets/ci.json +``` + +## Bulk Add All Rulesets +To add all rulesets in the `.rulesets` directory, you can wildcard the file name like this: + +```bash +gh api -X POST /repos/mdlutoronto/$REPONAME/rulesets --input .rulesets/*.json +``` +This command will add all JSON files in the `.rulesets` directory as rulesets to the specified repository. \ No newline at end of file diff --git a/.rulesets/ci.json b/.rulesets/ci.json new file mode 100644 index 0000000..f8dcee1 --- /dev/null +++ b/.rulesets/ci.json @@ -0,0 +1,31 @@ +{ + "id": 8997843, + "name": "ci", + "target": "branch", + "source_type": "Repository", + "enforcement": "active", + "conditions": { + "ref_name": { + "exclude": [], + "include": [ + "~DEFAULT_BRANCH" + ] + } + }, + "rules": [ + { + "type": "required_status_checks", + "parameters": { + "strict_required_status_checks_policy": true, + "do_not_enforce_on_create": false, + "required_status_checks": [ + { + "context": "CI Pipeline for Pull Requests", + "integration_id": 15368 + } + ] + } + } + ], + "bypass_actors": [] +} \ No newline at end of file From b66cc86301a186cbf718162c95967f13bd40baab Mon Sep 17 00:00:00 2001 From: kenlhlui <116421546+kenlhlui@users.noreply.github.com> Date: Fri, 14 Nov 2025 21:28:21 +0000 Subject: [PATCH 3/4] ci: Auto-update date to 2025-11-14 --- _config.yml | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/_config.yml b/_config.yml index 1943479..8845424 100644 --- a/_config.yml +++ b/_config.yml @@ -3,7 +3,6 @@ title: "Map & Data Library just the Docs Theme" description: "Workshops and guides from the Map & Data Library, University of Toronto" url: "https://MDLutoronto.github.io/jtd-theme" # change the slug to the repo's name ('jtd-theme' in this case) repository: "MDLutoronto/jtd-theme" # for github-metadata - ## Navigation footer logos and links ## Change it only if you want to use different logos or links ## Logos should be placed in the /assets/images/ directory, or you can use an external image link @@ -11,13 +10,11 @@ nav_footer_logo_bottom: "/assets/images/UTL.png" nav_footer_logo_bottom_href: "https://library.utoronto.ca/" nav_footer_logo_top: "/assets/images/mdl_full_logo.png" nav_footer_logo_top_href: "https://mdl.library.utoronto.ca/" - ## License information ## If left empty, a default Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license will be used license_name: "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International" license_url: "https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en" # link to the license license_image_url: "https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-sa.svg" # image Link or image file path for the license - # # Aux links for the upper right search bar (optional) # # Uncomment if you want to have the aux links (right side of the top nav bar) # aux_links: @@ -37,15 +34,11 @@ license_image_url: "https://mirrors.creativecommons.org/presskit/buttons/88x31/s # 🚨 DANGER ZONE 🚨 # ONLY CHANGE BELOW THIS LINE IF YOU KNOW WHAT YOU ARE DOING ################################################# - baseurl: "" # the subpath of your site, e.g. /blog - # Link for the site title in the sidebar; set to "/" for homepage title_link: "https://mdlutoronto.github.io/tutorials-search/" - # # Makes Aux links open in a new tab. Default is false aux_links_new_tab: true - # # External navigation links that appear in the sidebar and shows after all the sub-pages # # Each link must have a title and a url nav_external_links: @@ -58,19 +51,15 @@ nav_external_links: # # Color scheme currently only supports "dark", "light"/nil (default), or a custom scheme that you define color_scheme: mdl - # # Remote theme remote_theme: "MDLutoronto/jtd-theme" - permalink: pretty - defaults: - scope: path: "docs" # an empty string here means all files in the project type: "pages" values: layout: "default" - exclude: # from https://github.com/jekyll/jekyll/blob/master/lib/site_template/_config.yml: - .sass-cache/ @@ -98,7 +87,6 @@ exclude: - Dockerfile # theme test code - fixtures/ - # Set a path/url to a logo that will be displayed instead of the title #logo: "/assets/images/just-the-docs.png" @@ -130,10 +118,8 @@ search: button: false # Focus the search input by pressing `ctrl + focus_shortcut_key` (or `cmd + focus_shortcut_key` on macOS) focus_shortcut_key: "k" - # For copy button on code enable_copy_code_button: true - # By default, consuming the theme as a gem leaves mermaid disabled; it is opt-in mermaid: # Version of mermaid library @@ -147,35 +133,27 @@ mermaid: # for (