From 4dea8be25639b3d998c333b7a7e528498d2beda0 Mon Sep 17 00:00:00 2001 From: openhands Date: Mon, 9 Jun 2025 19:40:59 +0000 Subject: [PATCH 1/3] Sync GitHub workflows with upstream repository while preserving custom deploy workflows --- .github/workflows/axe.yml | 74 +++++++++++++++ .github/workflows/broken-links-site.yml | 47 ++++++++++ .github/workflows/broken-links.yml | 54 +++++++++++ .github/workflows/codeql.yml | 94 ++++++++++++++++++++ .github/workflows/deploy-docker-tag.yml | 68 ++++++++------ .github/workflows/deploy-image.yml | 53 ++++++----- .github/workflows/docker-slim.yml | 57 ++++++++++++ .github/workflows/lighthouse-badger.yml | 62 +++++++++++++ .github/workflows/prettier-comment-on-pr.yml | 18 ++++ .github/workflows/prettier-html.yml | 36 ++++++++ .github/workflows/prettier.yml | 48 ++++++++++ .github/workflows/schedule-posts.txt | 39 ++++++++ .github/workflows/update-tocs.yml | 50 +++++++++++ 13 files changed, 651 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/axe.yml create mode 100644 .github/workflows/broken-links-site.yml create mode 100644 .github/workflows/broken-links.yml create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/docker-slim.yml create mode 100644 .github/workflows/lighthouse-badger.yml create mode 100644 .github/workflows/prettier-comment-on-pr.yml create mode 100644 .github/workflows/prettier-html.yml create mode 100644 .github/workflows/prettier.yml create mode 100644 .github/workflows/schedule-posts.txt create mode 100644 .github/workflows/update-tocs.yml diff --git a/.github/workflows/axe.yml b/.github/workflows/axe.yml new file mode 100644 index 0000000000000..afa3c922190ee --- /dev/null +++ b/.github/workflows/axe.yml @@ -0,0 +1,74 @@ +name: Axe accessibility testing + +on: + # if you want to run this on every push uncomment the following lines + # push: + # branches: + # - master + # - main + # pull_request: + # branches: + # - master + # - main + workflow_dispatch: + inputs: + url: + description: "URL to be checked (e.g.: blog/)" + required: false + +env: + URL: "" + +jobs: + check: + # available images: https://github.com/actions/runner-images#available-images + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2.2" + bundler-cache: true + - name: Update _config.yml โš™๏ธ + uses: fjogeleit/yaml-update-action@main + with: + commitChange: false + valueFile: "_config.yml" + changes: | + { + "giscus.repo": "${{ github.repository }}", + "baseurl": "" + } + - name: Install and Build ๐Ÿ”ง + run: | + sudo apt-get update && sudo apt-get install -y imagemagick + pip3 install --upgrade jupyter + export JEKYLL_ENV=production + bundle exec jekyll build + - name: Purge unused CSS ๐Ÿงน + run: | + npm install -g purgecss + purgecss -c purgecss.config.js + - name: Get Chromium version ๐ŸŒ + # https://github.com/GoogleChromeLabs/chrome-for-testing?tab=readme-ov-file#other-api-endpoints + run: | + CHROMIUM_VERSION=$(wget -qO- https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE | cut -d. -f1) + echo "Chromium version: $CHROMIUM_VERSION" + echo "CHROMIUM_VERSION=$CHROMIUM_VERSION" >> $GITHUB_ENV + - name: Setup Chrome ๐ŸŒ + id: setup-chrome + uses: browser-actions/setup-chrome@v1 + with: + chrome-version: ${{ env.CHROMIUM_VERSION }} + - name: Install chromedriver ๐Ÿš— + run: | + npm install -g chromedriver@$CHROMIUM_VERSION + - name: Run axe ๐Ÿช“ + # https://github.com/dequelabs/axe-core-npm/tree/develop/packages/cli + run: | + npm install -g @axe-core/cli + npm install -g http-server + http-server _site/ & + axe --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver http://localhost:8080/${{ github.event.inputs.url || env.URL }} --load-delay=1500 --exit diff --git a/.github/workflows/broken-links-site.yml b/.github/workflows/broken-links-site.yml new file mode 100644 index 0000000000000..b6b9e2df6fd8b --- /dev/null +++ b/.github/workflows/broken-links-site.yml @@ -0,0 +1,47 @@ +name: Check for broken links on site + +on: + workflow_run: + workflows: [Deploy site] + types: [completed] + +jobs: + check-links-on-site: + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow + if: ${{ github.event.workflow_run.conclusion == 'success' }} + # available images: https://github.com/actions/runner-images#available-images + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2.2" + bundler-cache: true + - name: Update _config.yml โš™๏ธ + uses: fjogeleit/yaml-update-action@main + with: + commitChange: false + valueFile: "_config.yml" + changes: | + { + "giscus.repo": "${{ github.repository }}", + "baseurl": "" + } + - name: Install and Build ๐Ÿ”ง + run: | + sudo apt-get update && sudo apt-get install -y imagemagick + pip3 install --upgrade jupyter + export JEKYLL_ENV=production + bundle exec jekyll build + - name: Purge unused CSS ๐Ÿงน + run: | + npm install -g purgecss + purgecss -c purgecss.config.js + - name: Link Checker ๐Ÿ”— + uses: lycheeverse/lychee-action@v1.9.0 + with: + fail: true + # only check local links + args: --offline --remap '_site(/?.*)/assets/(.*) _site/assets/$2' --verbose --no-progress '_site/**/*.html' diff --git a/.github/workflows/broken-links.yml b/.github/workflows/broken-links.yml new file mode 100644 index 0000000000000..88a2ad4034e3a --- /dev/null +++ b/.github/workflows/broken-links.yml @@ -0,0 +1,54 @@ +name: Check for broken links + +on: + push: + branches: + - master + - main + paths: + - "assets/**" + - "**.html" + - "**.js" + - "**.liquid" + - "**/*.md" + - "**.yml" + - "!.github/workflows/axe.yml" + - "!.github/workflows/deploy-docker-tag.yml" + - "!.github/workflows/deploy-image.yml" + - "!.github/workflows/docker-slim.yml" + - "!.github/workflows/lighthouse-badger.yml" + - "!.github/workflows/prettier.yml" + - "!lighthouse_results/**" + pull_request: + branches: + - master + - main + paths: + - "assets/**" + - "**.html" + - "**.js" + - "**.liquid" + - "**/*.md" + - "**.yml" + - "!.github/workflows/axe.yml" + - "!.github/workflows/deploy-docker-tag.yml" + - "!.github/workflows/deploy-image.yml" + - "!.github/workflows/docker-slim.yml" + - "!.github/workflows/lighthouse-badger.yml" + - "!.github/workflows/prettier.yml" + - "!lighthouse_results/**" + +jobs: + link-checker: + runs-on: ubuntu-latest + # only run on the main repo + if: github.repository == 'alshedivat/al-folio' + steps: + - uses: actions/checkout@v4 + + - name: Link Checker ๐Ÿ”— + uses: lycheeverse/lychee-action@v2.1.0 + with: + fail: true + # removed md files that include liquid tags + args: --user-agent 'curl/7.54' --exclude-path README.md --exclude-path _pages/404.md --exclude-path _pages/blog.md --exclude-path _posts/2018-12-22-distill.md --exclude-path _posts/2023-04-24-videos.md --exclude-path _books/the_godfather.md --verbose --no-progress './**/*.md' './**/*.html' diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000000..d09a3b57548f4 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,94 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + schedule: + - cron: "45 4 * * 3" + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: javascript-typescript + build-mode: none + - language: ruby + build-mode: none + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # โ„น๏ธ Command-line programs to run using the OS shell. + # ๐Ÿ“š See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/deploy-docker-tag.yml b/.github/workflows/deploy-docker-tag.yml index 3e6b6a3a169fd..d7710e2683e64 100644 --- a/.github/workflows/deploy-docker-tag.yml +++ b/.github/workflows/deploy-docker-tag.yml @@ -3,38 +3,48 @@ name: Docker Image CI (Upload Tag) on: push: tags: - - 'v*' + - "v*" + paths: + - ".github/workflows/deploy-docker-tag.yml" + - ".github/workflows/deploy-image.yml" + - "bin/entry_point.sh" + - "Dockerfile" + - "Gemfile" + - "Gemfile.lock" + - "package.json" + - "package-lock.json" jobs: - build: - runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Buildx - uses: docker/setup-buildx-action@v1 - - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: amirpourmand/al-folio - - - name: Login - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: amirpourmand/al-folio + + - name: Login + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64/v8 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/deploy-image.yml b/.github/workflows/deploy-image.yml index b747dfc1d15c0..7ddd8f65003c5 100644 --- a/.github/workflows/deploy-image.yml +++ b/.github/workflows/deploy-image.yml @@ -2,30 +2,43 @@ name: Docker Image CI on: push: - branches: [ master ] - -jobs: + branches: + - master + - main + paths: + - ".github/workflows/deploy-image.yml" + - "bin/entry_point.sh" + - "Dockerfile" + - "Gemfile" + - "Gemfile.lock" + - "package.json" + - "package-lock.json" +jobs: build: - runs-on: ubuntu-latest if: github.repository_owner == 'alshedivat' steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Buildx - uses: docker/setup-buildx-action@v1 + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - - name: Login - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: amirpourmand/al-folio + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64/v8 + tags: amirpourmand/al-folio diff --git a/.github/workflows/docker-slim.yml b/.github/workflows/docker-slim.yml new file mode 100644 index 0000000000000..3a67d32a142d6 --- /dev/null +++ b/.github/workflows/docker-slim.yml @@ -0,0 +1,57 @@ +name: Docker Slim + +#Only trigger, when the build workflow succeeded +on: + push: + branches: + - master + - main + paths: + - ".github/workflows/docker-slim.yml" + workflow_run: + workflows: ["Docker Image CI"] + types: + - completed + +# on: +# push: +# branches: +# - 'master' + +jobs: + build: + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow + if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'alshedivat' }} + runs-on: ubuntu-latest + defaults: + run: + working-directory: ${{ github.workspace }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: update docker-compose + shell: bash + run: | + sed -i "s|\.:|${{ github.workspace }}:|g" ${{ github.workspace }}/docker-compose.yml + cat ${{ github.workspace }}/docker-compose.yml + + - uses: kitabisa/docker-slim-action@v1.1.1 + env: + DSLIM_PULL: true + DSLIM_COMPOSE_FILE: ${{ github.workspace }}/docker-compose.yml + DSLIM_TARGET_COMPOSE_SVC: jekyll + DSLIM_CONTINUE_AFTER: signal + with: + target: amirpourmand/al-folio + tag: "slim" + + # Push to the registry + - run: docker image push amirpourmand/al-folio:slim diff --git a/.github/workflows/lighthouse-badger.yml b/.github/workflows/lighthouse-badger.yml new file mode 100644 index 0000000000000..addec2d3165cf --- /dev/null +++ b/.github/workflows/lighthouse-badger.yml @@ -0,0 +1,62 @@ +# Lighthouse-Badger-Easy | GitHub Action Workflow +# +# Description: Generates, adds & updates manually/automatically Lighthouse badges & reports from one/multiple input URL(s) to the current repository & main branch with minimal settings +# Author: Sitdisch +# Source: https://github.com/myactionway/lighthouse-badger-workflows +# License: MIT +# Copyright (c) 2021 Sitdisch + +name: "Lighthouse Badger" + +######################################################################## +# DEFINE YOUR INPUTS AND TRIGGERS IN THE FOLLOWING +######################################################################## + +# INPUTS as Secrets (env) for not manually triggered workflows +env: + URLS: https://alshedivat.github.io/al-folio/ + # If any of the following env is blank, a default value is used instead + REPO_BRANCH: "${{ github.repository }} master" # target repository & branch e.g. 'dummy/mytargetrepo main' + MOBILE_LIGHTHOUSE_PARAMS: "--only-categories=performance,accessibility,best-practices,seo --throttling.cpuSlowdownMultiplier=2" + DESKTOP_LIGHTHOUSE_PARAMS: "--only-categories=performance,accessibility,best-practices,seo --preset=desktop --throttling.cpuSlowdownMultiplier=1" + +# TRIGGERS +on: + page_build: + # schedule: # Check your schedule here => https://crontab.guru/ + # - cron: '55 23 * * 0' # e.g. every Sunday at 23:55 + # + # THAT'S IT; YOU'RE DONE; + workflow_dispatch: + +######################################################################## +# THAT'S IT; YOU DON'T HAVE TO DEFINE ANYTHING IN THE FOLLOWING +######################################################################## + +jobs: + lighthouse-badger-easy: + runs-on: ubuntu-latest + timeout-minutes: 8 + steps: + - name: Preparatory Tasks + run: | + REPOSITORY=`expr "${{ env.REPO_BRANCH }}" : "\([^ ]*\)"` + BRANCH=`expr "${{ env.REPO_BRANCH }}" : ".* \([^ ]*\)"` + echo "REPOSITORY=$REPOSITORY" >> $GITHUB_ENV + echo "BRANCH=$BRANCH" >> $GITHUB_ENV + env: + REPO_BRANCH: ${{ env.REPO_BRANCH }} + - uses: actions/checkout@v4 + with: + repository: ${{ env.REPOSITORY }} + token: ${{ secrets.LIGHTHOUSE_BADGER_TOKEN }} + ref: ${{ env.BRANCH }} + - uses: actions/checkout@v4 + with: + repository: "myactionway/lighthouse-badges" + path: temp_lighthouse_badges_nested + - uses: myactionway/lighthouse-badger-action@v2.2 + with: + urls: ${{ env.URLS }} + mobile_lighthouse_params: ${{ env.MOBILE_LIGHTHOUSE_PARAMS }} + desktop_lighthouse_params: ${{ env.DESKTOP_LIGHTHOUSE_PARAMS }} diff --git a/.github/workflows/prettier-comment-on-pr.yml b/.github/workflows/prettier-comment-on-pr.yml new file mode 100644 index 0000000000000..e95075ce82e45 --- /dev/null +++ b/.github/workflows/prettier-comment-on-pr.yml @@ -0,0 +1,18 @@ +name: Comment on pull request + +on: + repository_dispatch: + types: [prettier-failed-on-pr] + +jobs: + comment: + # available images: https://github.com/actions/runner-images#available-images + runs-on: ubuntu-latest + steps: + - name: PR comment with html diff ๐Ÿ’ฌ + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: prettier-failed + pr_number: ${{ github.event.client_payload.pr_number }} + message: | + Failed [prettier code check](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.client_payload.run_id }}). Check [this file](${{ github.event.client_payload.artifact_url }}) for more information. diff --git a/.github/workflows/prettier-html.yml b/.github/workflows/prettier-html.yml new file mode 100644 index 0000000000000..3dc4326e12f8f --- /dev/null +++ b/.github/workflows/prettier-html.yml @@ -0,0 +1,36 @@ +name: Prettify gh-pages + +on: + workflow_dispatch: + +jobs: + format: + runs-on: ubuntu-latest + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v4 + with: + ref: gh-pages + + - name: Find and Remove Tags + run: find . -type f -name "*.html" -exec sed -i 's/<\/source>//g' {} + + + - name: Set up Node.js + uses: actions/setup-node@v4 + + - name: Install Prettier + run: npm install -g prettier + + - name: Check for Prettier + run: npx prettier --version || echo "Prettier not found" + + - name: Run Prettier on HTML files + run: npx prettier --write '**/*.html' + + - name: Commit and push changes + run: | + git config user.name "github-actions" + git config user.email "actions@github.com" + git add . + git commit -m "Formatted HTML files" || echo "No changes to commit" + git push diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml new file mode 100644 index 0000000000000..60446c8db3590 --- /dev/null +++ b/.github/workflows/prettier.yml @@ -0,0 +1,48 @@ +name: Prettier code formatter + +on: + pull_request: + branches: + - master + - main + push: + branches: + - master + - main + +jobs: + check: + # available images: https://github.com/actions/runner-images#available-images + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + - name: Setup Node.js โš™๏ธ + uses: actions/setup-node@v4 + - name: Install Prettier ๐Ÿ’พ + run: npm install --save-dev --save-exact prettier @shopify/prettier-plugin-liquid + - name: Prettier Check ๐Ÿ”Ž + id: prettier + run: npx prettier . --check + - name: Create diff ๐Ÿ“ + # https://docs.github.com/en/actions/learn-github-actions/expressions#failure + if: ${{ failure() }} + run: | + npx prettier . --write + git diff -- . ':(exclude)package-lock.json' ':(exclude)package.json' > diff.txt + npm install -g diff2html-cli + diff2html -i file -s side -F diff.html -- diff.txt + - name: Upload html diff โฌ†๏ธ + id: artifact-upload + if: ${{ failure() && steps.prettier.conclusion == 'failure' }} + uses: actions/upload-artifact@v4 + with: + name: HTML Diff + path: diff.html + retention-days: 7 + - name: Dispatch information to repository ๐Ÿ—ฃ๏ธ + if: ${{ failure() && steps.prettier.conclusion == 'failure' && github.event_name == 'pull_request' }} + uses: peter-evans/repository-dispatch@v2 + with: + event-type: prettier-failed-on-pr + client-payload: '{"pr_number": "${{ github.event.number }}", "artifact_url": "${{ steps.artifact-upload.outputs.artifact-url }}", "run_id": "${{ github.run_id }}"}' diff --git a/.github/workflows/schedule-posts.txt b/.github/workflows/schedule-posts.txt new file mode 100644 index 0000000000000..57728bca1e994 --- /dev/null +++ b/.github/workflows/schedule-posts.txt @@ -0,0 +1,39 @@ +name: Publish posts scheduled for today + +on: + schedule: + # Run every day at 23:30 UTC or manually run + - cron: "30 23 * * *" + workflow_dispatch: + +jobs: + publish_scheduled: + runs-on: ubuntu-latest + steps: + - name: Checkout main branch + uses: actions/checkout@v4 + with: + ref: main + + - name: Get the date for today + id: date + run: echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV + + - name: Check for scheduled posts and move to posts + run: | + echo "Today is $TODAY" + shopt -s nullglob + for file in _scheduled/${TODAY}-*.md; do + echo "Found scheduled: $file" + mv "$file" "_posts/" + echo "Moved $file to _posts/" + done + + - name: Commit and push changes + run: | + git config user.name "github-actions" + git config user.email "actions@github.com" + git add _posts/ + git add _scheduled/ + git commit -m "Posted Scheduled Drafts on $TODAY" || echo "No changes to commit" + git push diff --git a/.github/workflows/update-tocs.yml b/.github/workflows/update-tocs.yml new file mode 100644 index 0000000000000..3567ee82a8f6b --- /dev/null +++ b/.github/workflows/update-tocs.yml @@ -0,0 +1,50 @@ +name: Update TOCs +# This workflow automatically updates the Table of Contents (TOC) in markdown files + +on: + push: + branches: + - main + - master + paths: + - "*.md" + workflow_dispatch: + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46 + with: + files: ./*.md + + - name: Updated toc on all markdown changed files + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: | + curl https://raw.githubusercontent.com/george-gca/github-markdown-toc/main/gh-md-toc -o gh-md-toc + chmod a+x gh-md-toc + for file in ${ALL_CHANGED_FILES}; do + # Check if the file is a markdown file + if [[ "$file" != *.md ]]; then + continue + fi + ./gh-md-toc --indent 2 --insert --no-backup --hide-footer $file + done + rm gh-md-toc + + - name: Commit changes + if: steps.changed-files.outputs.any_changed == 'true' + uses: stefanzweifel/git-auto-commit-action@v5.0.1 + with: + commit_message: Auto update markdown TOC From b980d73acc2b584682a4c67b13ae5f7aca729ca6 Mon Sep 17 00:00:00 2001 From: openhands Date: Mon, 9 Jun 2025 19:41:04 +0000 Subject: [PATCH 2/3] Add upstream workflows for reference --- .github/workflows-upstream/axe.yml | 74 ++++++++++++ .../workflows-upstream/broken-links-site.yml | 47 ++++++++ .github/workflows-upstream/broken-links.yml | 54 +++++++++ .github/workflows-upstream/codeql.yml | 94 ++++++++++++++++ .../workflows-upstream/deploy-docker-tag.yml | 50 +++++++++ .github/workflows-upstream/deploy-image.yml | 44 ++++++++ .github/workflows-upstream/deploy.yml | 105 ++++++++++++++++++ .github/workflows-upstream/docker-slim.yml | 57 ++++++++++ .../workflows-upstream/lighthouse-badger.yml | 62 +++++++++++ .../prettier-comment-on-pr.yml | 18 +++ .github/workflows-upstream/prettier-html.yml | 36 ++++++ .github/workflows-upstream/prettier.yml | 48 ++++++++ .github/workflows-upstream/schedule-posts.txt | 39 +++++++ .github/workflows-upstream/update-tocs.yml | 50 +++++++++ 14 files changed, 778 insertions(+) create mode 100644 .github/workflows-upstream/axe.yml create mode 100644 .github/workflows-upstream/broken-links-site.yml create mode 100644 .github/workflows-upstream/broken-links.yml create mode 100644 .github/workflows-upstream/codeql.yml create mode 100644 .github/workflows-upstream/deploy-docker-tag.yml create mode 100644 .github/workflows-upstream/deploy-image.yml create mode 100644 .github/workflows-upstream/deploy.yml create mode 100644 .github/workflows-upstream/docker-slim.yml create mode 100644 .github/workflows-upstream/lighthouse-badger.yml create mode 100644 .github/workflows-upstream/prettier-comment-on-pr.yml create mode 100644 .github/workflows-upstream/prettier-html.yml create mode 100644 .github/workflows-upstream/prettier.yml create mode 100644 .github/workflows-upstream/schedule-posts.txt create mode 100644 .github/workflows-upstream/update-tocs.yml diff --git a/.github/workflows-upstream/axe.yml b/.github/workflows-upstream/axe.yml new file mode 100644 index 0000000000000..afa3c922190ee --- /dev/null +++ b/.github/workflows-upstream/axe.yml @@ -0,0 +1,74 @@ +name: Axe accessibility testing + +on: + # if you want to run this on every push uncomment the following lines + # push: + # branches: + # - master + # - main + # pull_request: + # branches: + # - master + # - main + workflow_dispatch: + inputs: + url: + description: "URL to be checked (e.g.: blog/)" + required: false + +env: + URL: "" + +jobs: + check: + # available images: https://github.com/actions/runner-images#available-images + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2.2" + bundler-cache: true + - name: Update _config.yml โš™๏ธ + uses: fjogeleit/yaml-update-action@main + with: + commitChange: false + valueFile: "_config.yml" + changes: | + { + "giscus.repo": "${{ github.repository }}", + "baseurl": "" + } + - name: Install and Build ๐Ÿ”ง + run: | + sudo apt-get update && sudo apt-get install -y imagemagick + pip3 install --upgrade jupyter + export JEKYLL_ENV=production + bundle exec jekyll build + - name: Purge unused CSS ๐Ÿงน + run: | + npm install -g purgecss + purgecss -c purgecss.config.js + - name: Get Chromium version ๐ŸŒ + # https://github.com/GoogleChromeLabs/chrome-for-testing?tab=readme-ov-file#other-api-endpoints + run: | + CHROMIUM_VERSION=$(wget -qO- https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE | cut -d. -f1) + echo "Chromium version: $CHROMIUM_VERSION" + echo "CHROMIUM_VERSION=$CHROMIUM_VERSION" >> $GITHUB_ENV + - name: Setup Chrome ๐ŸŒ + id: setup-chrome + uses: browser-actions/setup-chrome@v1 + with: + chrome-version: ${{ env.CHROMIUM_VERSION }} + - name: Install chromedriver ๐Ÿš— + run: | + npm install -g chromedriver@$CHROMIUM_VERSION + - name: Run axe ๐Ÿช“ + # https://github.com/dequelabs/axe-core-npm/tree/develop/packages/cli + run: | + npm install -g @axe-core/cli + npm install -g http-server + http-server _site/ & + axe --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver http://localhost:8080/${{ github.event.inputs.url || env.URL }} --load-delay=1500 --exit diff --git a/.github/workflows-upstream/broken-links-site.yml b/.github/workflows-upstream/broken-links-site.yml new file mode 100644 index 0000000000000..b6b9e2df6fd8b --- /dev/null +++ b/.github/workflows-upstream/broken-links-site.yml @@ -0,0 +1,47 @@ +name: Check for broken links on site + +on: + workflow_run: + workflows: [Deploy site] + types: [completed] + +jobs: + check-links-on-site: + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow + if: ${{ github.event.workflow_run.conclusion == 'success' }} + # available images: https://github.com/actions/runner-images#available-images + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2.2" + bundler-cache: true + - name: Update _config.yml โš™๏ธ + uses: fjogeleit/yaml-update-action@main + with: + commitChange: false + valueFile: "_config.yml" + changes: | + { + "giscus.repo": "${{ github.repository }}", + "baseurl": "" + } + - name: Install and Build ๐Ÿ”ง + run: | + sudo apt-get update && sudo apt-get install -y imagemagick + pip3 install --upgrade jupyter + export JEKYLL_ENV=production + bundle exec jekyll build + - name: Purge unused CSS ๐Ÿงน + run: | + npm install -g purgecss + purgecss -c purgecss.config.js + - name: Link Checker ๐Ÿ”— + uses: lycheeverse/lychee-action@v1.9.0 + with: + fail: true + # only check local links + args: --offline --remap '_site(/?.*)/assets/(.*) _site/assets/$2' --verbose --no-progress '_site/**/*.html' diff --git a/.github/workflows-upstream/broken-links.yml b/.github/workflows-upstream/broken-links.yml new file mode 100644 index 0000000000000..88a2ad4034e3a --- /dev/null +++ b/.github/workflows-upstream/broken-links.yml @@ -0,0 +1,54 @@ +name: Check for broken links + +on: + push: + branches: + - master + - main + paths: + - "assets/**" + - "**.html" + - "**.js" + - "**.liquid" + - "**/*.md" + - "**.yml" + - "!.github/workflows/axe.yml" + - "!.github/workflows/deploy-docker-tag.yml" + - "!.github/workflows/deploy-image.yml" + - "!.github/workflows/docker-slim.yml" + - "!.github/workflows/lighthouse-badger.yml" + - "!.github/workflows/prettier.yml" + - "!lighthouse_results/**" + pull_request: + branches: + - master + - main + paths: + - "assets/**" + - "**.html" + - "**.js" + - "**.liquid" + - "**/*.md" + - "**.yml" + - "!.github/workflows/axe.yml" + - "!.github/workflows/deploy-docker-tag.yml" + - "!.github/workflows/deploy-image.yml" + - "!.github/workflows/docker-slim.yml" + - "!.github/workflows/lighthouse-badger.yml" + - "!.github/workflows/prettier.yml" + - "!lighthouse_results/**" + +jobs: + link-checker: + runs-on: ubuntu-latest + # only run on the main repo + if: github.repository == 'alshedivat/al-folio' + steps: + - uses: actions/checkout@v4 + + - name: Link Checker ๐Ÿ”— + uses: lycheeverse/lychee-action@v2.1.0 + with: + fail: true + # removed md files that include liquid tags + args: --user-agent 'curl/7.54' --exclude-path README.md --exclude-path _pages/404.md --exclude-path _pages/blog.md --exclude-path _posts/2018-12-22-distill.md --exclude-path _posts/2023-04-24-videos.md --exclude-path _books/the_godfather.md --verbose --no-progress './**/*.md' './**/*.html' diff --git a/.github/workflows-upstream/codeql.yml b/.github/workflows-upstream/codeql.yml new file mode 100644 index 0000000000000..d09a3b57548f4 --- /dev/null +++ b/.github/workflows-upstream/codeql.yml @@ -0,0 +1,94 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + schedule: + - cron: "45 4 * * 3" + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: javascript-typescript + build-mode: none + - language: ruby + build-mode: none + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # โ„น๏ธ Command-line programs to run using the OS shell. + # ๐Ÿ“š See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows-upstream/deploy-docker-tag.yml b/.github/workflows-upstream/deploy-docker-tag.yml new file mode 100644 index 0000000000000..d7710e2683e64 --- /dev/null +++ b/.github/workflows-upstream/deploy-docker-tag.yml @@ -0,0 +1,50 @@ +name: Docker Image CI (Upload Tag) + +on: + push: + tags: + - "v*" + paths: + - ".github/workflows/deploy-docker-tag.yml" + - ".github/workflows/deploy-image.yml" + - "bin/entry_point.sh" + - "Dockerfile" + - "Gemfile" + - "Gemfile.lock" + - "package.json" + - "package-lock.json" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: amirpourmand/al-folio + + - name: Login + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64/v8 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows-upstream/deploy-image.yml b/.github/workflows-upstream/deploy-image.yml new file mode 100644 index 0000000000000..7ddd8f65003c5 --- /dev/null +++ b/.github/workflows-upstream/deploy-image.yml @@ -0,0 +1,44 @@ +name: Docker Image CI + +on: + push: + branches: + - master + - main + paths: + - ".github/workflows/deploy-image.yml" + - "bin/entry_point.sh" + - "Dockerfile" + - "Gemfile" + - "Gemfile.lock" + - "package.json" + - "package-lock.json" + +jobs: + build: + runs-on: ubuntu-latest + if: github.repository_owner == 'alshedivat' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64/v8 + tags: amirpourmand/al-folio diff --git a/.github/workflows-upstream/deploy.yml b/.github/workflows-upstream/deploy.yml new file mode 100644 index 0000000000000..5fb7e8ae21c91 --- /dev/null +++ b/.github/workflows-upstream/deploy.yml @@ -0,0 +1,105 @@ +name: Deploy site + +on: + push: + branches: + - master + - main + paths: + - "assets/**" + - "_sass/**" + - "_scripts/**" + - "**.bib" + - "**.html" + - "**.js" + - "**.liquid" + - "**/*.md" + - "**.yml" + - "Gemfile" + - "Gemfile.lock" + - "!.github/workflows/axe.yml" + - "!.github/workflows/broken-links.yml" + - "!.github/workflows/deploy-docker-tag.yml" + - "!.github/workflows/deploy-image.yml" + - "!.github/workflows/docker-slim.yml" + - "!.github/workflows/lighthouse-badger.yml" + - "!.github/workflows/prettier.yml" + - "!lighthouse_results/**" + - "!CONTRIBUTING.md" + - "!CUSTOMIZE.md" + - "!FAQ.md" + - "!INSTALL.md" + - "!README.md" + pull_request: + branches: + - master + - main + paths: + - "assets/**" + - "_sass/**" + - "_scripts/**" + - "**.bib" + - "**.html" + - "**.js" + - "**.liquid" + - "**/*.md" + - "**.yml" + - "Gemfile" + - "Gemfile.lock" + - "!.github/workflows/axe.yml" + - "!.github/workflows/broken-links.yml" + - "!.github/workflows/deploy-docker-tag.yml" + - "!.github/workflows/deploy-image.yml" + - "!.github/workflows/docker-slim.yml" + - "!.github/workflows/lighthouse-badger.yml" + - "!.github/workflows/prettier.yml" + - "!lighthouse_results/**" + - "!CONTRIBUTING.md" + - "!CUSTOMIZE.md" + - "!FAQ.md" + - "!INSTALL.md" + - "!README.md" + workflow_dispatch: + +permissions: + contents: write + +jobs: + deploy: + # available images: https://github.com/actions/runner-images#available-images + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + - name: Setup Ruby ๐Ÿ’Ž + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.3.5" + bundler-cache: true + - name: Setup Python ๐Ÿ + uses: actions/setup-python@v5 + with: + python-version: "3.13" + cache: "pip" # caching pip dependencies + - name: Update _config.yml โš™๏ธ + uses: fjogeleit/yaml-update-action@main + with: + commitChange: false + valueFile: "_config.yml" + propertyPath: "giscus.repo" + value: ${{ github.repository }} + - name: Install and Build ๐Ÿ”ง + run: | + sudo apt-get update && sudo apt-get install -y imagemagick + pip3 install --upgrade nbconvert + export JEKYLL_ENV=production + bundle exec jekyll build + - name: Purge unused CSS ๐Ÿงน + run: | + npm install -g purgecss + purgecss -c purgecss.config.js + - name: Deploy ๐Ÿš€ + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: _site diff --git a/.github/workflows-upstream/docker-slim.yml b/.github/workflows-upstream/docker-slim.yml new file mode 100644 index 0000000000000..3a67d32a142d6 --- /dev/null +++ b/.github/workflows-upstream/docker-slim.yml @@ -0,0 +1,57 @@ +name: Docker Slim + +#Only trigger, when the build workflow succeeded +on: + push: + branches: + - master + - main + paths: + - ".github/workflows/docker-slim.yml" + workflow_run: + workflows: ["Docker Image CI"] + types: + - completed + +# on: +# push: +# branches: +# - 'master' + +jobs: + build: + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow + if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'alshedivat' }} + runs-on: ubuntu-latest + defaults: + run: + working-directory: ${{ github.workspace }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: update docker-compose + shell: bash + run: | + sed -i "s|\.:|${{ github.workspace }}:|g" ${{ github.workspace }}/docker-compose.yml + cat ${{ github.workspace }}/docker-compose.yml + + - uses: kitabisa/docker-slim-action@v1.1.1 + env: + DSLIM_PULL: true + DSLIM_COMPOSE_FILE: ${{ github.workspace }}/docker-compose.yml + DSLIM_TARGET_COMPOSE_SVC: jekyll + DSLIM_CONTINUE_AFTER: signal + with: + target: amirpourmand/al-folio + tag: "slim" + + # Push to the registry + - run: docker image push amirpourmand/al-folio:slim diff --git a/.github/workflows-upstream/lighthouse-badger.yml b/.github/workflows-upstream/lighthouse-badger.yml new file mode 100644 index 0000000000000..addec2d3165cf --- /dev/null +++ b/.github/workflows-upstream/lighthouse-badger.yml @@ -0,0 +1,62 @@ +# Lighthouse-Badger-Easy | GitHub Action Workflow +# +# Description: Generates, adds & updates manually/automatically Lighthouse badges & reports from one/multiple input URL(s) to the current repository & main branch with minimal settings +# Author: Sitdisch +# Source: https://github.com/myactionway/lighthouse-badger-workflows +# License: MIT +# Copyright (c) 2021 Sitdisch + +name: "Lighthouse Badger" + +######################################################################## +# DEFINE YOUR INPUTS AND TRIGGERS IN THE FOLLOWING +######################################################################## + +# INPUTS as Secrets (env) for not manually triggered workflows +env: + URLS: https://alshedivat.github.io/al-folio/ + # If any of the following env is blank, a default value is used instead + REPO_BRANCH: "${{ github.repository }} master" # target repository & branch e.g. 'dummy/mytargetrepo main' + MOBILE_LIGHTHOUSE_PARAMS: "--only-categories=performance,accessibility,best-practices,seo --throttling.cpuSlowdownMultiplier=2" + DESKTOP_LIGHTHOUSE_PARAMS: "--only-categories=performance,accessibility,best-practices,seo --preset=desktop --throttling.cpuSlowdownMultiplier=1" + +# TRIGGERS +on: + page_build: + # schedule: # Check your schedule here => https://crontab.guru/ + # - cron: '55 23 * * 0' # e.g. every Sunday at 23:55 + # + # THAT'S IT; YOU'RE DONE; + workflow_dispatch: + +######################################################################## +# THAT'S IT; YOU DON'T HAVE TO DEFINE ANYTHING IN THE FOLLOWING +######################################################################## + +jobs: + lighthouse-badger-easy: + runs-on: ubuntu-latest + timeout-minutes: 8 + steps: + - name: Preparatory Tasks + run: | + REPOSITORY=`expr "${{ env.REPO_BRANCH }}" : "\([^ ]*\)"` + BRANCH=`expr "${{ env.REPO_BRANCH }}" : ".* \([^ ]*\)"` + echo "REPOSITORY=$REPOSITORY" >> $GITHUB_ENV + echo "BRANCH=$BRANCH" >> $GITHUB_ENV + env: + REPO_BRANCH: ${{ env.REPO_BRANCH }} + - uses: actions/checkout@v4 + with: + repository: ${{ env.REPOSITORY }} + token: ${{ secrets.LIGHTHOUSE_BADGER_TOKEN }} + ref: ${{ env.BRANCH }} + - uses: actions/checkout@v4 + with: + repository: "myactionway/lighthouse-badges" + path: temp_lighthouse_badges_nested + - uses: myactionway/lighthouse-badger-action@v2.2 + with: + urls: ${{ env.URLS }} + mobile_lighthouse_params: ${{ env.MOBILE_LIGHTHOUSE_PARAMS }} + desktop_lighthouse_params: ${{ env.DESKTOP_LIGHTHOUSE_PARAMS }} diff --git a/.github/workflows-upstream/prettier-comment-on-pr.yml b/.github/workflows-upstream/prettier-comment-on-pr.yml new file mode 100644 index 0000000000000..e95075ce82e45 --- /dev/null +++ b/.github/workflows-upstream/prettier-comment-on-pr.yml @@ -0,0 +1,18 @@ +name: Comment on pull request + +on: + repository_dispatch: + types: [prettier-failed-on-pr] + +jobs: + comment: + # available images: https://github.com/actions/runner-images#available-images + runs-on: ubuntu-latest + steps: + - name: PR comment with html diff ๐Ÿ’ฌ + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: prettier-failed + pr_number: ${{ github.event.client_payload.pr_number }} + message: | + Failed [prettier code check](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.client_payload.run_id }}). Check [this file](${{ github.event.client_payload.artifact_url }}) for more information. diff --git a/.github/workflows-upstream/prettier-html.yml b/.github/workflows-upstream/prettier-html.yml new file mode 100644 index 0000000000000..3dc4326e12f8f --- /dev/null +++ b/.github/workflows-upstream/prettier-html.yml @@ -0,0 +1,36 @@ +name: Prettify gh-pages + +on: + workflow_dispatch: + +jobs: + format: + runs-on: ubuntu-latest + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v4 + with: + ref: gh-pages + + - name: Find and Remove Tags + run: find . -type f -name "*.html" -exec sed -i 's/<\/source>//g' {} + + + - name: Set up Node.js + uses: actions/setup-node@v4 + + - name: Install Prettier + run: npm install -g prettier + + - name: Check for Prettier + run: npx prettier --version || echo "Prettier not found" + + - name: Run Prettier on HTML files + run: npx prettier --write '**/*.html' + + - name: Commit and push changes + run: | + git config user.name "github-actions" + git config user.email "actions@github.com" + git add . + git commit -m "Formatted HTML files" || echo "No changes to commit" + git push diff --git a/.github/workflows-upstream/prettier.yml b/.github/workflows-upstream/prettier.yml new file mode 100644 index 0000000000000..60446c8db3590 --- /dev/null +++ b/.github/workflows-upstream/prettier.yml @@ -0,0 +1,48 @@ +name: Prettier code formatter + +on: + pull_request: + branches: + - master + - main + push: + branches: + - master + - main + +jobs: + check: + # available images: https://github.com/actions/runner-images#available-images + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + - name: Setup Node.js โš™๏ธ + uses: actions/setup-node@v4 + - name: Install Prettier ๐Ÿ’พ + run: npm install --save-dev --save-exact prettier @shopify/prettier-plugin-liquid + - name: Prettier Check ๐Ÿ”Ž + id: prettier + run: npx prettier . --check + - name: Create diff ๐Ÿ“ + # https://docs.github.com/en/actions/learn-github-actions/expressions#failure + if: ${{ failure() }} + run: | + npx prettier . --write + git diff -- . ':(exclude)package-lock.json' ':(exclude)package.json' > diff.txt + npm install -g diff2html-cli + diff2html -i file -s side -F diff.html -- diff.txt + - name: Upload html diff โฌ†๏ธ + id: artifact-upload + if: ${{ failure() && steps.prettier.conclusion == 'failure' }} + uses: actions/upload-artifact@v4 + with: + name: HTML Diff + path: diff.html + retention-days: 7 + - name: Dispatch information to repository ๐Ÿ—ฃ๏ธ + if: ${{ failure() && steps.prettier.conclusion == 'failure' && github.event_name == 'pull_request' }} + uses: peter-evans/repository-dispatch@v2 + with: + event-type: prettier-failed-on-pr + client-payload: '{"pr_number": "${{ github.event.number }}", "artifact_url": "${{ steps.artifact-upload.outputs.artifact-url }}", "run_id": "${{ github.run_id }}"}' diff --git a/.github/workflows-upstream/schedule-posts.txt b/.github/workflows-upstream/schedule-posts.txt new file mode 100644 index 0000000000000..57728bca1e994 --- /dev/null +++ b/.github/workflows-upstream/schedule-posts.txt @@ -0,0 +1,39 @@ +name: Publish posts scheduled for today + +on: + schedule: + # Run every day at 23:30 UTC or manually run + - cron: "30 23 * * *" + workflow_dispatch: + +jobs: + publish_scheduled: + runs-on: ubuntu-latest + steps: + - name: Checkout main branch + uses: actions/checkout@v4 + with: + ref: main + + - name: Get the date for today + id: date + run: echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV + + - name: Check for scheduled posts and move to posts + run: | + echo "Today is $TODAY" + shopt -s nullglob + for file in _scheduled/${TODAY}-*.md; do + echo "Found scheduled: $file" + mv "$file" "_posts/" + echo "Moved $file to _posts/" + done + + - name: Commit and push changes + run: | + git config user.name "github-actions" + git config user.email "actions@github.com" + git add _posts/ + git add _scheduled/ + git commit -m "Posted Scheduled Drafts on $TODAY" || echo "No changes to commit" + git push diff --git a/.github/workflows-upstream/update-tocs.yml b/.github/workflows-upstream/update-tocs.yml new file mode 100644 index 0000000000000..3567ee82a8f6b --- /dev/null +++ b/.github/workflows-upstream/update-tocs.yml @@ -0,0 +1,50 @@ +name: Update TOCs +# This workflow automatically updates the Table of Contents (TOC) in markdown files + +on: + push: + branches: + - main + - master + paths: + - "*.md" + workflow_dispatch: + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46 + with: + files: ./*.md + + - name: Updated toc on all markdown changed files + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: | + curl https://raw.githubusercontent.com/george-gca/github-markdown-toc/main/gh-md-toc -o gh-md-toc + chmod a+x gh-md-toc + for file in ${ALL_CHANGED_FILES}; do + # Check if the file is a markdown file + if [[ "$file" != *.md ]]; then + continue + fi + ./gh-md-toc --indent 2 --insert --no-backup --hide-footer $file + done + rm gh-md-toc + + - name: Commit changes + if: steps.changed-files.outputs.any_changed == 'true' + uses: stefanzweifel/git-auto-commit-action@v5.0.1 + with: + commit_message: Auto update markdown TOC From 0410ffb9c783698d41835194414952c36aeea603 Mon Sep 17 00:00:00 2001 From: openhands Date: Mon, 9 Jun 2025 19:41:36 +0000 Subject: [PATCH 3/3] Update GitHub workflows and issue templates from upstream --- .github/ISSUE_TEMPLATE/1_bug_report.yml | 102 ++++++++++++++++++ .github/ISSUE_TEMPLATE/2_feature_request.yml | 56 ++++++++++ .github/ISSUE_TEMPLATE/config.yml | 8 ++ .github/release.yml | 14 +++ .github/workflows/deploy.yml | 105 +++++++++++++++++++ 5 files changed, 285 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/1_bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/2_feature_request.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/release.yml create mode 100644 .github/workflows/deploy.yml diff --git a/.github/ISSUE_TEMPLATE/1_bug_report.yml b/.github/ISSUE_TEMPLATE/1_bug_report.yml new file mode 100644 index 0000000000000..495f3f439e151 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1_bug_report.yml @@ -0,0 +1,102 @@ +name: ๐Ÿ› Report a bug +description: Any errors. +labels: ["needs triage", "bug"] +body: + - type: markdown + attributes: + value: > + Before you go any further. Is this really a **๐Ÿ› bug**? + + If it's a question about how al-folio works, have a look at our [documentation](https://github.com/alshedivat/al-folio/blob/main/README.md), + [frequently asked questions](https://github.com/alshedivat/al-folio/blob/main/FAQ.md), + [past questions](https://github.com/alshedivat/al-folio/discussions/categories/q-a), + or [ask a question](https://github.com/alshedivat/al-folio/discussions/new?category=q-a). + + - type: checkboxes + id: requirements + attributes: + label: Have you checked that your issue isn't already filed? + description: > + Please check if somebody else has already filed the same issue. + If you find a similar issue, please add a ๐Ÿ‘ reaction or comment on the original post. + options: + - label: I read through [FAQ](https://github.com/alshedivat/al-folio/blob/main/FAQ.md) and searched through the [past issues](https://github.com/alshedivat/al-folio/issues), none of which addressed my issue. + required: true + - label: Yes, I have checked that this issue isn't already filed. + required: true + + - type: input + attributes: + label: Bug description + description: A description of the ๐Ÿ› bug. + placeholder: A clear and concise description of what the bug is. + validations: + required: true + + - type: textarea + attributes: + label: How to reproduce the bug + description: Provide steps to reproduce the ๐Ÿ› bug. + placeholder: | + Include steps to reproduce, the expected behaviour, and the actual behaviour. + + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + + - type: textarea + attributes: + label: Error messages and logs + description: > + Provide any error messages and/or logs + placeholder: "Copy the complete error messages and logs" + value: | + ``` + The error message you got, with the full traceback if available. Please paste it between these triple backticks. + ``` + validations: + required: false + + - type: dropdown + id: os + attributes: + label: What operating system are you using? + description: select all OSs where you have experienced this issue + multiple: true + options: + - Linux + - Mac + - Windows + - Not applicable (e.g. you're using GitHub Pages or other hosting) + validations: + required: true + + - type: dropdown + id: environment + attributes: + label: Where are you seeing the problem on? + description: select all environments where you have experienced this issue + multiple: true + options: + - "Running locally with Docker (docker compose)" + - "Running locally with Docker (devcontainer)" + - "Running locally without Docker" + - "Deployed site" + validations: + required: true + + - type: textarea + attributes: + label: More info + description: Add any other info about the issue here. + placeholder: | + Add any other context about the problem here, such as versions of the libraries if running without docker, screenshots, links to the deployed site, etc. + validations: + required: false + + - type: markdown + attributes: + value: "**Happy coding!**" \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/2_feature_request.yml b/.github/ISSUE_TEMPLATE/2_feature_request.yml new file mode 100644 index 0000000000000..3afe26484bb4a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2_feature_request.yml @@ -0,0 +1,56 @@ +name: ๐Ÿš€ Feature request +description: Propose a feature for this project +labels: ["needs triage", "enhancement"] +body: + - type: markdown + attributes: + value: > + Before you go any further, are you sure that this feature is not already implemented? + + If it's a question about how al-folio works, have a look at our [documentation](https://github.com/alshedivat/al-folio/blob/main/README.md), + [frequently asked questions](https://github.com/alshedivat/al-folio/blob/main/FAQ.md), + [past questions](https://github.com/alshedivat/al-folio/discussions/categories/q-a), + or [ask a question](https://github.com/alshedivat/al-folio/discussions/new?category=q-a). + + - type: checkboxes + id: requirements + attributes: + label: Have you checked that your feature request isn't already filed? + description: > + Please check if somebody else has already filed the same ๐Ÿš€ feature request. + If you find a similar feature request, please add a ๐Ÿ‘ reaction or comment on the original post. + options: + - label: I read through [FAQ](https://github.com/alshedivat/al-folio/blob/main/FAQ.md) and searched through the [past issues](https://github.com/alshedivat/al-folio/issues), none of which addressed my feature request. + required: true + - label: Yes, I have checked that this feature request isn't already filed. + required: true + + - type: textarea + attributes: + label: Description & Motivation + description: A clear and concise description of the ๐Ÿš€ feature proposal + placeholder: | + Please outline the motivation for the proposal. + Is your feature request related to a problem? e.g., I'm always frustrated when [...]. + If this is related to another GitHub issue, please link it here + + - type: textarea + attributes: + label: Pitch + description: A clear and concise description of what you want to happen. + validations: + required: false + + - type: textarea + attributes: + label: Alternatives + description: A clear and concise description of any alternative solutions or features you've considered, if any. + validations: + required: false + + - type: textarea + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. + validations: + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000000..b884be02cb07b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: โ“ Ask a Question + url: https://github.com/alshedivat/al-folio/discussions/categories/q-a + about: Ask and answer al-folio related questions. + - name: ๐Ÿ“– Read the documentation + url: https://github.com/alshedivat/al-folio/blob/main/README.md + about: Please consult the documentation before opening any issues! \ No newline at end of file diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000000000..62764d22e5452 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,14 @@ +changelog: + exclude: + labels: + - ignore-for-release + categories: + - title: new features ๐Ÿš€ + labels: + - enhancement + - title: bug fixes and improvements โœจ + labels: + - bug-fix + - title: other changes ๐Ÿ› ๏ธ + labels: + - "*" \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000000000..c480cf5df355e --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,105 @@ +name: Deploy site + +on: + push: + branches: + - master + - main + paths: + - "assets/**" + - "_sass/**" + - "_scripts/**" + - "**.bib" + - "**.html" + - "**.js" + - "**.liquid" + - "**/*.md" + - "**.yml" + - "Gemfile" + - "Gemfile.lock" + - "!.github/workflows/axe.yml" + - "!.github/workflows/broken-links.yml" + - "!.github/workflows/deploy-docker-tag.yml" + - "!.github/workflows/deploy-image.yml" + - "!.github/workflows/docker-slim.yml" + - "!.github/workflows/lighthouse-badger.yml" + - "!.github/workflows/prettier.yml" + - "!lighthouse_results/**" + - "!CONTRIBUTING.md" + - "!CUSTOMIZE.md" + - "!FAQ.md" + - "!INSTALL.md" + - "!README.md" + pull_request: + branches: + - master + - main + paths: + - "assets/**" + - "_sass/**" + - "_scripts/**" + - "**.bib" + - "**.html" + - "**.js" + - "**.liquid" + - "**/*.md" + - "**.yml" + - "Gemfile" + - "Gemfile.lock" + - "!.github/workflows/axe.yml" + - "!.github/workflows/broken-links.yml" + - "!.github/workflows/deploy-docker-tag.yml" + - "!.github/workflows/deploy-image.yml" + - "!.github/workflows/docker-slim.yml" + - "!.github/workflows/lighthouse-badger.yml" + - "!.github/workflows/prettier.yml" + - "!lighthouse_results/**" + - "!CONTRIBUTING.md" + - "!CUSTOMIZE.md" + - "!FAQ.md" + - "!INSTALL.md" + - "!README.md" + workflow_dispatch: + +permissions: + contents: write + +jobs: + deploy: + # available images: https://github.com/actions/runner-images#available-images + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + - name: Setup Ruby ๐Ÿ’Ž + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.3.5" + bundler-cache: true + - name: Setup Python ๐Ÿ + uses: actions/setup-python@v5 + with: + python-version: "3.13" + cache: "pip" # caching pip dependencies + - name: Update _config.yml โš™๏ธ + uses: fjogeleit/yaml-update-action@main + with: + commitChange: false + valueFile: "_config.yml" + propertyPath: "giscus.repo" + value: ${{ github.repository }} + - name: Install and Build ๐Ÿ”ง + run: | + sudo apt-get update && sudo apt-get install -y imagemagick + pip3 install --upgrade nbconvert + export JEKYLL_ENV=production + bundle exec jekyll build + - name: Purge unused CSS ๐Ÿงน + run: | + npm install -g purgecss + purgecss -c purgecss.config.js + - name: Deploy ๐Ÿš€ + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: _site \ No newline at end of file