diff --git a/.github/workflows/ci_pr.yml b/.github/workflows/ci_pr.yml new file mode 100644 index 0000000..3cb9741 --- /dev/null +++ b/.github/workflows/ci_pr.yml @@ -0,0 +1,45 @@ +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" \ No newline at end of file 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 diff --git a/_config.yml b/_config.yml index 4baa899..8845424 100644 --- a/_config.yml +++ b/_config.yml @@ -1,9 +1,8 @@ ## 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 ## 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,21 +10,18 @@ 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: # "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" @@ -38,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/" - +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: @@ -59,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/ @@ -99,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" @@ -131,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 @@ -148,37 +133,27 @@ mermaid: # for ({{ 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 -%} +
Last updated: {{ page.last_modified_date | default: site.ci_last_modified_date | date: "%B %d, %Y"}} {%- if site.workshop_series_name and site.workshop_series_name != '' -%}

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