From 13736aec5ed230a41c2cd1fdc34f7aedc4cad735 Mon Sep 17 00:00:00 2001 From: John Mertic Date: Wed, 26 Nov 2025 12:18:59 -0500 Subject: [PATCH] Refactor workflow for Jekyll PR previews Updated workflow to build Jekyll previews and deploy to GitHub Pages. Signed-off-by: John Mertic --- .github/workflows/preview.yml | 66 +++++++++++++++++++++++++++ .github/workflows/scorecards.yml | 76 -------------------------------- 2 files changed, 66 insertions(+), 76 deletions(-) create mode 100644 .github/workflows/preview.yml delete mode 100644 .github/workflows/scorecards.yml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000..81e7509 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,66 @@ +name: Jekyll PR Previews + +on: + pull_request: + +permissions: + contents: read + pages: write + id-token: write + pull-requests: write + +jobs: + build: + runs-on: ubuntu-latest + outputs: + pr_path: ${{ steps.setpath.outputs.pr_path }} + + steps: + - name: Checkout + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 + + - name: Setup Ruby + uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0 + with: + ruby-version: "3.2" + bundler-cache: true + + # Determine output folder: main → root, PR → /pr-/ + - name: Determine output path + id: setpath + run: | + echo "pr_path=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT + + # Build Jekyll + - name: Build Jekyll + run: | + DEST="./_site/${{ steps.setpath.outputs.pr_path }}" + mkdir -p "$DEST" + bundle exec jekyll build --destination "$DEST" --trace --baseurl "/pr-${{ github.event.pull_request.number }}/" + + # Upload the artifact for deployment + - name: Upload Pages Artifact + uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0 + with: + path: _site + + deploy: + runs-on: ubuntu-latest + needs: build + + # Deploy for both PRs and main + steps: + - name: Deploy to GitHub Pages + id: deploy + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 + + # Comment PR preview URL + - name: Comment PR Preview URL + uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + 🔍 **Unique Jekyll PR Preview Ready** + + Preview URL: + **https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-${{ github.event.pull_request.number }}/** diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml deleted file mode 100644 index e39788b..0000000 --- a/.github/workflows/scorecards.yml +++ /dev/null @@ -1,76 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. They are provided -# by a third-party and are governed by separate terms of service, privacy -# policy, and support documentation. - -name: Scorecard supply-chain security -on: - # For Branch-Protection check. Only the default branch is supported. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection - branch_protection_rule: - # To guarantee Maintained check is occasionally updated. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained - schedule: - - cron: '20 7 * * 2' - push: - branches: ["main"] - -# Declare default permissions as read only. -permissions: read-all - -jobs: - analysis: - name: Scorecard analysis - runs-on: ubuntu-latest - permissions: - # Needed to upload the results to code-scanning dashboard. - security-events: write - # Needed to publish results and get a badge (see publish_results below). - id-token: write - contents: read - actions: read - - steps: - - name: Harden Runner - uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 - with: - egress-policy: audit - - - name: "Checkout code" - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - - - name: "Run analysis" - uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 - with: - results_file: results.sarif - results_format: sarif - # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: - # - you want to enable the Branch-Protection check on a *public* repository, or - # - you are installing Scorecards on a *private* repository - # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. - # repo_token: ${{ secrets.SCORECARD_TOKEN }} - - # Public repositories: - # - Publish results to OpenSSF REST API for easy access by consumers - # - Allows the repository to include the Scorecard badge. - # - See https://github.com/ossf/scorecard-action#publishing-results. - # For private repositories: - # - `publish_results` will always be set to `false`, regardless - # of the value entered here. - publish_results: true - - # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF - # format to the repository Actions tab. - - name: "Upload artifact" - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: SARIF file - path: results.sarif - retention-days: 5 - - # Upload the results to GitHub's code scanning dashboard. - - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.5 - with: - sarif_file: results.sarif