From 485b41d358909eecd2366ba77227d244e338dddb Mon Sep 17 00:00:00 2001 From: Awab Date: Wed, 3 Jun 2026 21:02:43 -0400 Subject: [PATCH 1/5] Fix indentation --- .github/workflows/ci.yml | 138 +++++++++++++++++----------------- .github/workflows/publish.yml | 86 ++++++++++----------- 2 files changed, 111 insertions(+), 113 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9485cd..fb00df0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,83 +1,81 @@ name: LaTeX CI on: -pull_request: -branches: [ master ] -push: -branches: [ master ] + pull_request: + branches: + - master + push: + branches: + - master jobs: -changes: -runs-on: ubuntu-latest - -outputs: - matrix: ${{ steps.matrix.outputs.matrix }} - -steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - id: matrix - shell: bash - run: | - DOCS=("bylaws" "policies" "board-procedures") - - if [ "${{ github.event_name }}" = "pull_request" ]; then - BASE_SHA="${{ github.event.pull_request.base.sha }}" - else - BASE_SHA="${{ github.event.before }}" - fi - - CHANGED=$(git diff --name-only "$BASE_SHA" "${{ github.sha }}") - - SHARED_CHANGED=false - for file in logo.png mathsoc.cls mathsoc.sty title.tex; do - if echo "$CHANGED" | grep -q "^${file}$"; then - SHARED_CHANGED=true - break - fi - done - - if [ "$SHARED_CHANGED" = true ]; then - MATRIX='{"directory":["bylaws","policies","board-procedures"]}' - else - DIRS=() - - for dir in "${DOCS[@]}"; do - if echo "$CHANGED" | grep -q "^${dir}/"; then - DIRS+=("\"${dir}\"") + build: + runs-on: ubuntu-latest + + container: + image: ghcr.io/xu-cheng/texlive-full:latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Determine changed documents + id: changed + shell: bash + run: | + if [ "${{ github.event_name }}" = "pull_request" ]; then + BASE_SHA="${{ github.event.pull_request.base.sha }}" + else + BASE_SHA="${{ github.event.before }}" fi - done - MATRIX="{\"directory\":[$(IFS=,; echo "${DIRS[*]}")]}" - fi + CHANGED=$(git diff --name-only "$BASE_SHA" "${{ github.sha }}") - echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT" + BUILD_BYLAWS=false + BUILD_POLICIES=false + BUILD_BOARD=false -build: -needs: changes - -if: ${{ fromJson(needs.changes.outputs.matrix).directory[0] != null }} - -runs-on: ubuntu-latest - -strategy: - fail-fast: false - matrix: ${{ fromJson(needs.changes.outputs.matrix) }} + if echo "$CHANGED" | grep -Eq '^(logo\.png|mathsoc\.cls|mathsoc\.sty|title\.tex)$'; then + BUILD_BYLAWS=true + BUILD_POLICIES=true + BUILD_BOARD=true + fi -container: - image: ghcr.io/xu-cheng/texlive-full:latest + if echo "$CHANGED" | grep -q '^bylaws/'; then + BUILD_BYLAWS=true + fi -steps: - - uses: actions/checkout@v4 + if echo "$CHANGED" | grep -q '^policies/'; then + BUILD_POLICIES=true + fi - - name: Build ${{ matrix.directory }} - run: | - make -C "${{ matrix.directory }}" public + if echo "$CHANGED" | grep -q '^board-procedures/'; then + BUILD_BOARD=true + fi - - name: Upload PDF - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.directory }} - path: ${{ matrix.directory }}/dist/*.pdf + echo "bylaws=$BUILD_BYLAWS" >> $GITHUB_OUTPUT + echo "policies=$BUILD_POLICIES" >> $GITHUB_OUTPUT + echo "board=$BUILD_BOARD" >> $GITHUB_OUTPUT + + - name: Build bylaws + if: steps.changed.outputs.bylaws == 'true' + run: make -C bylaws public + + - name: Build policies + if: steps.changed.outputs.policies == 'true' + run: make -C policies public + + - name: Build board-procedures + if: steps.changed.outputs.board == 'true' + run: make -C board-procedures public + + - name: Upload PDFs + uses: actions/upload-artifact@v4 + with: + name: generated-pdfs + path: | + bylaws/dist/*.pdf + policies/dist/*.pdf + board-procedures/dist/*.pdf + if-no-files-found: ignore diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dfacc96..7fdd4f7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,65 +1,65 @@ name: Publish PDFs on: -push: -branches: -- master + push: + branches: + - master permissions: -contents: read -pages: write -id-token: write + contents: read + pages: write + id-token: write concurrency: -group: pages -cancel-in-progress: true + group: pages + cancel-in-progress: true jobs: -build: -runs-on: ubuntu-latest + build: + runs-on: ubuntu-latest -container: - image: ghcr.io/xu-cheng/texlive-full:latest + container: + image: ghcr.io/xu-cheng/texlive-full:latest -steps: - - uses: actions/checkout@v4 + steps: + - uses: actions/checkout@v4 - - name: Build bylaws - run: make -C bylaws public + - name: Build bylaws + run: make -C bylaws public - - name: Build policies - run: make -C policies public + - name: Build policies + run: make -C policies public - - name: Build board-procedures - run: make -C board-procedures public + - name: Build board-procedures + run: make -C board-procedures public - - name: Prepare Pages content - run: | - mkdir site + - name: Prepare Pages content + run: | + mkdir site - cp bylaws/dist/*.pdf site/ - cp policies/dist/*.pdf site/ - cp board-procedures/dist/*.pdf site/ + cp bylaws/dist/*.pdf site/ + cp policies/dist/*.pdf site/ + cp board-procedures/dist/*.pdf site/ - - name: Upload Pages artifact - uses: actions/upload-pages-artifact@v3 - with: - path: site + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: site -deploy: -needs: build + deploy: + needs: build -runs-on: ubuntu-latest + runs-on: ubuntu-latest -environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} -permissions: - pages: write - id-token: write + permissions: + pages: write + id-token: write -steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From 3b4cfeb4587b54324c7c668d94e87e92ad474618 Mon Sep 17 00:00:00 2001 From: Awab Date: Wed, 3 Jun 2026 21:11:11 -0400 Subject: [PATCH 2/5] Refactor --- .github/workflows/ci.yml | 9 +----- .github/workflows/publish.yml | 60 +++++++++++++++++------------------ 2 files changed, 30 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb00df0..200c027 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,6 @@ on: pull_request: branches: - master - push: - branches: - - master jobs: build: @@ -24,11 +21,7 @@ jobs: id: changed shell: bash run: | - if [ "${{ github.event_name }}" = "pull_request" ]; then - BASE_SHA="${{ github.event.pull_request.base.sha }}" - else - BASE_SHA="${{ github.event.before }}" - fi + BASE_SHA="${{ github.event.pull_request.base.sha }}" CHANGED=$(git diff --name-only "$BASE_SHA" "${{ github.sha }}") diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7fdd4f7..36fceb6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,57 +9,55 @@ permissions: contents: read pages: write id-token: write + actions: read concurrency: group: pages cancel-in-progress: true jobs: - build: + deploy: runs-on: ubuntu-latest - container: - image: ghcr.io/xu-cheng/texlive-full:latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} steps: - uses: actions/checkout@v4 - - name: Build bylaws - run: make -C bylaws public - - - name: Build policies - run: make -C policies public - - - name: Build board-procedures - run: make -C board-procedures public + - name: Download PDFs from latest CI run + uses: dawidd6/action-download-artifact@v6 + with: + name: generated-pdfs + workflow: ci.yml + branch: master + path: site/ + if_no_artifact_found: warn - - name: Prepare Pages content + - name: Generate index page run: | - mkdir site - - cp bylaws/dist/*.pdf site/ - cp policies/dist/*.pdf site/ - cp board-procedures/dist/*.pdf site/ + cat > site/index.html << 'EOF' + + + Documents + +

Documents

+ EOF + + for pdf in site/*.pdf; do + name=$(basename "$pdf") + echo "$name" >> site/index.html + done + + echo "" >> site/index.html - name: Upload Pages artifact uses: actions/upload-pages-artifact@v3 with: path: site - deploy: - needs: build - - runs-on: ubuntu-latest - - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - permissions: - pages: write - id-token: write - - steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 From 53f07bc260e842c9b01acac65e04f766361cb20e Mon Sep 17 00:00:00 2001 From: Awab Date: Wed, 3 Jun 2026 21:14:48 -0400 Subject: [PATCH 3/5] What?? there's a website now too whaaaa --- .github/workflows/ci.yml | 11 -------- .github/workflows/publish.yml | 49 ++++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 200c027..b066d0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,6 @@ jobs: shell: bash run: | BASE_SHA="${{ github.event.pull_request.base.sha }}" - CHANGED=$(git diff --name-only "$BASE_SHA" "${{ github.sha }}") BUILD_BYLAWS=false @@ -62,13 +61,3 @@ jobs: - name: Build board-procedures if: steps.changed.outputs.board == 'true' run: make -C board-procedures public - - - name: Upload PDFs - uses: actions/upload-artifact@v4 - with: - name: generated-pdfs - path: | - bylaws/dist/*.pdf - policies/dist/*.pdf - board-procedures/dist/*.pdf - if-no-files-found: ignore diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 36fceb6..5d68601 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,12 +5,6 @@ on: branches: - master -permissions: - contents: read - pages: write - id-token: write - actions: read - concurrency: group: pages cancel-in-progress: true @@ -19,6 +13,12 @@ jobs: deploy: runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write + actions: read + environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -27,23 +27,46 @@ jobs: - uses: actions/checkout@v4 - name: Download PDFs from latest CI run + id: download uses: dawidd6/action-download-artifact@v6 with: name: generated-pdfs workflow: ci.yml branch: master - path: site/ + path: artifacts/ if_no_artifact_found: warn - - name: Generate index page + - name: Check PDFs were downloaded + id: check + run: | + COUNT=$(find artifacts/ -name "*.pdf" 2>/dev/null | wc -l) + echo "pdf_count=$COUNT" >> $GITHUB_OUTPUT + if [ "$COUNT" -eq 0 ]; then + echo "No PDFs found — nothing to publish." + fi + + - name: Prepare site + if: steps.check.outputs.pdf_count != '0' run: | + mkdir -p site + + # Flatten PDFs from nested dist/ dirs into site root + find artifacts/ -name "*.pdf" -exec cp {} site/ \; + + # Generate index page cat > site/index.html << 'EOF' - Documents - -

Documents

+ + + Documents + + + +

Documents

EOF for pdf in site/*.pdf; do @@ -54,10 +77,12 @@ jobs: echo "" >> site/index.html - name: Upload Pages artifact + if: steps.check.outputs.pdf_count != '0' uses: actions/upload-pages-artifact@v3 with: path: site - name: Deploy to GitHub Pages + if: steps.check.outputs.pdf_count != '0' id: deployment uses: actions/deploy-pages@v4 From 322a5d1413f228220a21d33814b307d7ef1d049c Mon Sep 17 00:00:00 2001 From: Awab Date: Wed, 3 Jun 2026 21:16:25 -0400 Subject: [PATCH 4/5] Fix cannot access bug --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b066d0d..e52b8f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,10 @@ jobs: id: changed shell: bash run: | - BASE_SHA="${{ github.event.pull_request.base.sha }}" - CHANGED=$(git diff --name-only "$BASE_SHA" "${{ github.sha }}") + # Fetch master so we have the ref to diff against + git fetch origin master --depth=1 + + CHANGED=$(git diff --name-only origin/master...HEAD) BUILD_BYLAWS=false BUILD_POLICIES=false From fade96f64c75d9e0686c7221b36338a24212eb6d Mon Sep 17 00:00:00 2001 From: Awab Date: Wed, 3 Jun 2026 21:19:14 -0400 Subject: [PATCH 5/5] Fix git perms issue --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e52b8f1..698d0cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,9 @@ jobs: with: fetch-depth: 0 + - name: Mark workspace safe for git + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" + - name: Determine changed documents id: changed shell: bash