Skip to content

Link checker

Link checker #147

Workflow file for this run

name: Build PDFs
on: [push, pull_request]
jobs:
build:
name: Build all .pdf files
# pull requests are a duplicate of a branch push if within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
# runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
fail-fast: false
env:
TZ: America/New_York
steps:
- name: Checkout the repo
uses: actions/checkout@v3
with:
# Fetch all history for all tags and branches
# (https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches)
fetch-depth: 0
- name: Install Dependencies
run: |
set -vxeuo pipefail
sudo apt-get update
sudo apt-get install -y \
texlive \
texlive-latex-extra \
texlive-fonts-extra \
ghostscript
- name: Check time
run: |
set -vxeuo pipefail
date
echo "Time zone: ${TZ}"
- name: Run build
run: |
set -vxeuo pipefail
./build.sh
- name: Check logs
run: |
cat tmp/RakitinMS_CV.log
- uses: actions/upload-artifact@v3
with:
name: pdfs
path: Rakitin*.pdf
- name: Commit new files
run: |
set -vxeuo pipefail
# Define the branch to which we push the resulting files:
export NOW="$(date +%Y%m%d%H%M%S)"
# https://docs.github.com/en/actions/learn-github-actions/contexts#determining-when-to-use-contexts
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
export PUSH_BRANCH="main"
else
export PUSH_BRANCH="${NOW}"
fi
# This is needed to propagate this variable to other steps:
echo "PUSH_BRANCH=${PUSH_BRANCH}" >> $GITHUB_ENV
# Set required git config parameters:
echo "::group::git config"
git config --global user.name "bot-auto-push"
git config --global user.email "mrakitin@users.noreply.github.com"
echo "::endgroup::"
# Print diagnostics information in the expandable group in the log:
echo "::group::git state"
git remote -v
git branch -avv
git status
echo "::endgroup::"
# Conditionally check out to a new branch:
if [ "${PUSH_BRANCH}" != "main" ]; then
git checkout -b "${PUSH_BRANCH}"
fi
# Add files and commit:
git add *.pdf
git commit -m "[BOT] Update on ${NOW}"
# Print diagnostics information in the expandable group in the log:
echo "::group::git log"
git log -n5 --stat
echo "::endgroup::"
- name: Push new files
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
# if: ${{ github.event_name == 'pull_request' }}
# Only git push on the 'push' action to avoid potential duplicate branches:
if: ${{ github.event_name == 'push' }}
run: |
set -vxeuo pipefail
# Print diagnostics information in the expandable groups in the log:
echo "::group::env"
env | sort -u
echo "::endgroup::"
echo "::group::git state"
git remote -v
git branch -avv
git status
echo "::endgroup::"
echo "::group::git log"
git log -n5 --stat
echo "::endgroup::"
# Push the changes to the target branch:
git push -u origin "${PUSH_BRANCH}"