spec/contributors: Add alt text for avatars #334
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
pip3 install -r requirements.txt | |
- name: "Linting: autocorrect" | |
continue-on-error: true | |
run: | | |
curl -fsSL https://raw.githubusercontent.com/huacnlee/autocorrect/main/install | sh | |
autocorrect --fix | |
- name: "Linting: markdownlint-cli2 Part 1" | |
uses: DavidAnson/markdownlint-cli2-action@v15 | |
continue-on-error: true | |
with: | |
fix: true | |
globs: | | |
docs/**/*.md | |
README.md | |
- name: "Linting: markdownlint-cli2 Part 2" | |
uses: DavidAnson/markdownlint-cli2-action@v15 | |
continue-on-error: true | |
with: | |
fix: true | |
globs: | | |
docs/**/*.md | |
README.md | |
- name: Stop and report errors if not master | |
if: github.ref != 'refs/heads/master' | |
run: | | |
git add -A | |
if ! git diff-index --quiet --cached HEAD --; then | |
echo "Stop." | |
exit 1 | |
fi | |
- name: Determine if a PR should be submitted | |
if: github.ref == 'refs/heads/master' | |
id: file_changes | |
run: | | |
git add -A | |
if git diff-index --quiet --cached HEAD --; then | |
echo "should_submit=false" >> "$GITHUB_OUTPUT" | |
else | |
echo "should_submit=true" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Submit PR from linting | |
if: steps.file_changes.outputs.should_submit == 'true' && github.ref == 'refs/heads/master' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
commit-message: "Auto fix formatting from GitHub Actions run ${{ github.run_number }}" | |
assignees: "${{ github.actor }}" | |
branch: auto-fix-actions-${{ github.run_number }} | |
delete-branch: true | |
title: "Fix formatting from GitHub Actions run ${{ github.run_number }}" | |
body: | | |
Attempt to automatically fix formatting issues in ${{ github.sha }}. | |
This PR is generated by GitHub Actions [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}). Please choose **Squash and Merge** for this PR. | |
- name: Build docs | |
run: | | |
mkdocs -v build | |
: > site/.nojekyll | |
echo -n '201.ustclug.org' > site/CNAME | |
- name: Deploy to GitHub Pages | |
if: github.ref == 'refs/heads/master' | |
run: | | |
CINFO="$(git log -1 --pretty="%an: [%h] %s")" | |
git clone --depth=1 --branch=gh-pages --single-branch --no-checkout \ | |
"https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" test | |
mv test/.git site/.git && rmdir test/ | |
pushd site/ &>/dev/null | |
git add -A | |
git -c user.name=GitHub -c [email protected] commit \ | |
-m "Auto deploy from GitHub Actions build ${GITHUB_RUN_NUMBER}" \ | |
-m "$CINFO" \ | |
--allow-empty | |
git push | |
popd &>/dev/null |