Skip to content

Lint RST inline code on GitHub Actions #1570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U docutils

- name: Build
run: make -j$(nproc)

- name: Deploy
if: >
(
github.repository == 'python/peps' &&
github.ref == 'refs/heads/master'
)

run: |
bash deploy.bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually triggering a deployment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but only for the python/peps repo and master branch (like .travis.yml).

As a demo, here's another branch that allows a deploy for my fork and that branch:

The deploy is triggered (and fails, as expected due to lack of credentials in my repo):

25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U pre-commit

- name: Lint
run: make lint
env:
PRE_COMMIT_COLOR: always
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.6.0
hooks:
- id: rst-backticks
exclude: >
(?x)^(
pep-0012.rst|
pep-0505.rst|
pep-0550.rst|
pep-0567.rst|
pep-0572.rst
)$
- id: rst-inline-touching-normal
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ package: all rss
cp *.png build/peps/
cp *.rss build/peps/
tar -C build -czf build/peps.tar.gz peps

lint:
pre-commit run --all-files