Skip to content
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

Workflow test 1 #7

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 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
15 changes: 15 additions & 0 deletions .github/workflows/clean-output.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import re

with open('output.log') as oldfile, open('error.log', 'w') as newfile:
for line in oldfile:
if not (b'\xE2\x9A\xA0' in line.encode()):
if ('warning' in line):
r = line.partition("warning")[2].partition(" remark")[0]
s = str(r).rsplit(' ', 1)[0]
newfile.write(s)
if ('home/runner/work' in line):
s = line.replace("/home/runner/work/free-programming-books/", "", 1)
newfile.write(s)
else:
newfile.write("\n\n")

45 changes: 41 additions & 4 deletions .github/workflows/fpb-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,56 @@ name: free-programming-books-lint

on: [push, pull_request]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_RUN_ID: ${{ github.run_id }}
PR: ${{ github.event.pull_request.html_url }}

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
- run: npm install -g free-programming-books-lint
- run: fpb-lint ./books/
- run: fpb-lint ./casts/
- run: fpb-lint ./courses/
- run: fpb-lint ./more/

- name: Push
if: ${{ github.event_name == 'push' }}
run: |
fpb-lint ./books/
fpb-lint ./casts/
fpb-lint ./courses/
fpb-lint ./more/

- name: Pull Request
if: ${{ always() &&
github.event_name == 'pull_request' }}
run: |
fpb-lint ./books/ &>> output.log || echo "Analyzing..."
fpb-lint ./casts/ &>> output.log || echo "Analyzing..."
fpb-lint ./courses/ &>> output.log || echo "Analyzing..."
fpb-lint ./more/ &>> output.log || echo "Analyzing..."

python ./.github/workflows/clean-output.py
cat error.log

if [ -s error.log ]
then
gh pr review $PR -r -b "Linter failed, fix the error(s):
\`\`\`
$(cat error.log)
\`\`\`"
gh pr edit $PR --add-label "linter error"
else
gh pr review $PR -a
gh pr edit $PR --remove-label "linter error"
fi
2 changes: 1 addition & 1 deletion books/free-programming-books-langs.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ That section got so big, we decided to split it into its own file, the [BY SUBJE
* [Advanced Bash-Scripting Guide](http://tldp.org/LDP/abs/html/) - M. Cooper (HTML)
* [Bash Guide for Beginners (2008)](http://www.tldp.org/LDP/Bash-Beginners-Guide/html/) - M. Garrels (HTML)
* [Bash Notes for Professionals](http://goalkicker.com/BashBook/) - Compiled from StackOverflow documentation (PDF)
* [BASH Programming (2000)](http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html) - Mike G. (HTML)
* [ABASH Programming (2000)](http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html) - Mike G. (HTML)
* [Bash Reference Manual](http://www.gnu.org/software/bash/manual/bashref.html) (HTML)
* [Bash tutorial](https://web.archive.org/web/20180328183806/http://gdrcorelec.ups-tlse.fr/files/bash.pdf) - Anthony Scemama (PDF)
* [BashGuide](http://mywiki.wooledge.org/BashGuide) - Maarten Billemont (HTML) [(PDF)](http://s.ntnu.no/bashguide.pdf)
Expand Down
2 changes: 1 addition & 1 deletion courses/free-courses-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
### Algorithms & Data Structures

* [Advanced Data Structures](http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-851-advanced-data-structures-spring-2012/) - Erik Demaine
* [Algorithm Design and Implementation](https://www.youtube.com/playlist?list=PL6EF0274BD849A7D5)
* [BBAlgorithm Design and Implementation](https://www.youtube.com/playlist?list=PL6EF0274BD849A7D5)
* [Algorithms](https://www.youtube.com/playlist?list=PLDN4rrl48XKpZkf03iYFl-O29szjTrs_O) - Abdul Bari
* [Berkeley University CS 61B: Data Structures](http://datastructur.es/sp16/)
* [Berkeley's CS 61B: Data Structures](https://archive.org/details/ucberkeley_webcast_QMV45tHCYNI)
Expand Down