Skip to content

[WIP] PR previews v2 #10

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

Open
wants to merge 73 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
07b9f94
Add contributing guide for restructuring tutorial
amakarudze Apr 18, 2023
f105422
build and deploy ePub e-book files
das-g Apr 29, 2023
06833a6
name ePub files sensibly
das-g May 3, 2023
cb56296
link to ePub e-book in HTML (web) version
das-g Oct 8, 2023
cc62917
add note about editing commands
afeld Feb 21, 2024
6e735b7
update python and django versions
zahidkizmaz Apr 21, 2024
3b508aa
remove unnecessary comma
zahidkizmaz Apr 21, 2024
0431f76
instructions to create github access token
0orja Apr 21, 2024
07fd613
fix formatting on book.json
zahidkizmaz Apr 21, 2024
16c5091
set python anywhere version to 3.10
zahidkizmaz Apr 21, 2024
fdaa946
Merge branch 'DjangoGirls:master' into update-versions
zahidkizmaz Apr 21, 2024
d8cf432
update django version in docs to 4.2
zahidkizmaz Apr 28, 2024
a74a64e
remove new line
zahidkizmaz Apr 28, 2024
2e46145
Remove Runcode instructions
ekohl May 18, 2024
b760730
Merge pull request #1834 from ekohl/remove-runcode
ekohl May 18, 2024
1e2dac4
Fix link to CONTRIBUTING
kerhac Apr 27, 2024
ab6985b
Fix broken links due to html reference
kerhac Apr 27, 2024
6c34507
Add missing images taken from English translation
kerhac Apr 27, 2024
fed9d66
Merge pull request #1830 from kerhac/master
das-g May 18, 2024
f56c64d
remove changes from sk/django_views/README.md
zahidkizmaz May 25, 2024
df4ec11
Fixed typo in italian translation
raffaellasuardini Jun 9, 2024
5f1d1de
chore removed space
raffaellasuardini Jun 9, 2024
1a65739
Merge pull request #1819 from afeld/patch-1
amakarudze Jul 10, 2024
c3473f9
Merge pull request #1825 from 0orja/troubleshoot-github-auth
amakarudze Jul 10, 2024
4ab5fdb
Merge pull request #1826 from zahidkizmaz/update-versions
amakarudze Jul 10, 2024
52d42f2
Changed Chromebook setup instructions
kewtree1408 Sep 19, 2024
b3e3c69
Added localhost to ALLOWED_HOSTS in settings.py
kewtree1408 Sep 19, 2024
9672a00
Add info about auto-deletion of GitHub Workspace
kewtree1408 Sep 19, 2024
2cc2b6e
Fixed path to the images
kewtree1408 Sep 19, 2024
317e2b6
Added csuggestions for git installation bug for Mac M1/M2/M3 ussers
fltfx Sep 25, 2024
744e784
Added github generate access token instructions
fltfx Sep 25, 2024
ddf4018
Fixes from PR discussion:
kewtree1408 Sep 28, 2024
01043a0
Forgot to add new screenshots for the "Deploy".
kewtree1408 Sep 28, 2024
5a29cbb
Reverted the "Ignoring files" part and ...
kewtree1408 Sep 28, 2024
f2689ab
Merge pull request #1847 from kewtree1408/move-away-from-Cloud9
das-g Sep 29, 2024
e623868
Merge pull request #1848 from fltfx/fltfx_osx_git_installation
amakarudze Sep 30, 2024
2794ec4
Remove gitter.im links from the english README.md file
mcagl Oct 11, 2024
b623a14
Remove the gitter.im link also from the sidebar
mcagl Oct 11, 2024
15b70fa
Merge pull request #1849 from mcagl/feature/remove-gitter.im-links
amakarudze Oct 11, 2024
0ac55a9
Merge branch 'master' into update-readme-1793
fltfx Oct 11, 2024
04c70d6
Merge pull request #1794 from amakarudze/update-readme-1793
fltfx Oct 13, 2024
00794e2
Merge pull request #1795 from DjangoGirls/epub
fltfx Oct 13, 2024
12022c6
Updating bootstrap and bootstrap-icons versions
dennybiasiolli Mar 6, 2024
d9e95e7
Updating python and django versions usage to latest available versions
dennybiasiolli Mar 6, 2024
cfaabfa
Updating images for new github repo and python install options on win…
dennybiasiolli Mar 6, 2024
3886adb
Merge pull request #1820 from dennybiasiolli/updating-tutorial
fltfx Oct 14, 2024
fda50a9
renaming OS X to macOS and updating references
dennybiasiolli Mar 19, 2024
e9ee3d5
Merge pull request #1852 from dennybiasiolli/updating-tutorial-v2
fltfx Oct 14, 2024
04f7c70
Wording and formatting fixes
mcagl Oct 25, 2024
0357024
Change STATIC_URL as it is created by django-admin startproject
mcagl Oct 25, 2024
d6d12e4
Fix the typo Extentions -> Extensions in the screenshot
mcagl Oct 25, 2024
f2a8efb
Change the screenshot with a django 5.1 one
mcagl Oct 25, 2024
e65238c
Update README.md with Open in Codeanywhere button
marko-baric-ca Nov 5, 2024
29fba4e
Move Windows after macOS and Linux, for coherence with the rest of th…
mcagl Nov 15, 2024
d2b212b
Fix command in images: first 'git add' then 'git commit'
mcagl Nov 15, 2024
284c53e
MDN is a better source of information wrt W3Schools
mcagl Nov 15, 2024
c143437
Better wording
mcagl Nov 15, 2024
24aa6f5
Seems to sound better like this
mcagl Nov 15, 2024
90000b6
Formatting
mcagl Nov 15, 2024
676411d
Clearer wording
mcagl Nov 15, 2024
0470262
I think this is what was intended
mcagl Nov 15, 2024
9ae17ad
Fix http -> https where applicable
mcagl Nov 15, 2024
508cef2
Fix Twitter -> X
mcagl Nov 15, 2024
584056c
Run GitHub Actions on Ubuntu 24.04
ekohl Nov 19, 2024
ef2ca84
Merge pull request #1856 from ekohl/fix-rename-in-deploy
ekohl Nov 19, 2024
8f72b0c
Install rename
amakarudze Nov 23, 2024
95b8964
Merge pull request #1857 from amakarudze/fix-ci-issues
amakarudze Nov 23, 2024
41fc6a3
Merge pull request #1837 from raffaellasuardini/master
amakarudze Nov 23, 2024
fba1420
Merge pull request #1853 from marko-baric-ca/patch-1
amakarudze Nov 23, 2024
f72dfe3
Merge pull request #1854 from mcagl/feature/check-tutorial-update-status
amakarudze Nov 23, 2024
22a116e
Implement previews for GitHub pull requests
ekohl May 18, 2024
5b66051
[WIP] Remove non-EN languages for faser testing
ekohl May 19, 2024
458b681
fixup! Implement previews for GitHub pull requests
ekohl Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 9 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,23 @@ concurrency:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: calibre
- name: Install and Build
run: |
sudo apt install rename
npm install
npx honkit build
npx honkit epub
rename 's/^book/django-girls-tutorial/' book_*.epub
mv *.epub _book/
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand All @@ -40,7 +47,7 @@ jobs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Deploy to GitHub Pages
id: deployment
Expand Down
109 changes: 109 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Preview

on:
workflow_run:
workflows:
- Build
types:
- completed

jobs:
preview-failed:
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion != 'success'
runs-on: ubuntu-latest
steps:
- name: Download metadata artifact
run: gh run download '${{ github.event.workflow_run.id }}' --name pr
env:
GH_TOKEN: ${{ github.token }}

- name: Read PR data
run: echo "PR_NUMBER=$(cat ./pr)" >> $GITHUB_ENV

- name: Comment on PR
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ env.PR_NUMBER }}
message: "The PR preview for ${{ github.event.workflow_run.head_sha }} could not be generated"

preview:
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
# TODO: can this download from the existing pages or a cache?
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Build current pages
run: |
npm install
npx honkit build
mv _book current

- name: Download preview artifact
run: gh run download '${{ github.event.workflow_run.id }}' --name github-pages --dir preview
env:
GH_TOKEN: ${{ github.token }}

- name: Remove indeterminism
run: |
find current/ preview/ -type f -exec sed -i '/gitbook.page.hasChanged/d' {} +

- name: Create diff to current
run: |
diff -Nrwu --exclude search_index.json current/ preview/ > diff.patch || true
if [[ -s diff.patch ]] ; then
sudo apt-get update
sudo apt-get install -y diffstat python3-pygments

mv diff.patch preview/diff.patch
pygmentize -o preview/diff.html -l diff -f html -O full preview/diff.patch
diffstat -l -p1 preview/diff.patch > preview/diff.txt
fi

- name: Download metadata artifact
run: gh run download '${{ github.event.workflow_run.id }}' --name pr
env:
GH_TOKEN: ${{ github.token }}

- name: Read PR data
run: echo "PR_NUMBER=$(cat ./pr)" >> $GITHUB_ENV

- name: Set preview domain
run: echo "PREVIEW_DOMAIN=$(echo ${{ github.repository }} | tr / - )-${{ github.job }}-pr-${{ env.PR_NUMBER }}.surge.sh" >> $GITHUB_ENV

- name: Install surge
run: npm install surge

- name: Deploy to surge.sh
run: npx surge ./preview $PREVIEW_DOMAIN --token ${{ secrets.SURGE_TOKEN }}

- name: Generate summary
run: |
echo "The PR preview for ${{ github.event.workflow_run.head_sha }} is available at [${{ env.PREVIEW_DOMAIN }}](https://${{ env.PREVIEW_DOMAIN }})" >> pr.md
echo "" >> pr.md

if [[ -f preview/diff.txt ]] ; then
echo "The following output files are affected by this PR:" >> pr.md
sed -E "s#(.*)#- [\1](https://${{ env.PREVIEW_DOMAIN }}/\1)#" preview/diff.txt >> pr.md
else
echo "No diff compared to the current website" >> pr.md
fi

if [[ -s preview/diff.patch ]] ; then
echo "" >> pr.md
echo "[show diff](https://${{ env.PREVIEW_DOMAIN }}/diff.patch)" >> pr.md
fi

if [[ -f preview/diff.html ]] ; then
echo "" >> pr.md
echo "[show diff as HTML](https://${{ env.PREVIEW_DOMAIN }}/diff.html)" >> pr.md
fi

- name: Comment on PR
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ env.PR_NUMBER }}
path: pr.md
17 changes: 16 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -15,3 +15,18 @@ jobs:
run: |
npm install
npx honkit build

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: github-pages
path: _book/**

- name: Save PR metadata
run: |
echo ${{ github.event.number }} > ./pr

- uses: actions/upload-artifact@v4
with:
name: pr
path: ./pr
19 changes: 0 additions & 19 deletions LANGS.md
Original file line number Diff line number Diff line change
@@ -1,20 +1 @@
* [🇺🇸 English](en/)
* [🇧🇬 Български (beta)](bg/)
* [🇨🇿 Čeština (beta)](cs/)
* [🇩🇪 Deutsch](de/)
* [🇬🇷 Ελληνικά (beta)](el/)
* [🇪🇸 Español (beta)](es/)
* [🇮🇷 فارسی (beta)](fa/)
* [🇫🇷 Français (beta)](fr/)
* [🇭🇺 Magyar (beta)](hu/)
* [🇦🇲 հայերեն (beta)](hy/)
* [🇮🇹 Italiano (beta)](it/)
* [🇯🇵 日本語](ja/)
* [🇰🇵/🇰🇷 한국어 (beta)](ko/)
* [🇵🇱 Polski](pl/)
* [🇧🇷 Português-brasileiro](pt/)
* [🇷🇺 Русский (beta)](ru/)
* [🇸🇰 Slovenčina (beta)](sk/)
* [🇹🇷 Türkçe (beta)](tr/)
* [🇺🇦 Українська](uk/)
* [🇨🇳 简体中文](zh/)
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Open in Codeanywhere](https://img.shields.io/badge/Open%20in-Codeanywhere-7f3f97)](https://app.codeanywhere.com/#https://github.com/DjangoGirls/tutorial)

# Django Girls Tutorial

~ 🖥 Source Code 🖥 ~
Expand Down Expand Up @@ -44,7 +46,7 @@ For contributing to the tutorial the following is needed to get started:
* a [GitHub account](https://github.com)
* in the case of complex edits familiarity with [Git command line basics](https://help.github.com/articles/set-up-git) or familiarity with an app ([Windows](https://windows.github.com/), [Mac](https://mac.github.com/)) to push your edits made on your computer to GitHub.

## Fork the repository
## Fork the repository {#fork-the-repository}

First fork the [DjangoGirls/tutorial](https://github.com/DjangoGirls/tutorial) repository to your personal GitHub account:

Expand Down Expand Up @@ -78,7 +80,7 @@ Markdown syntax is used to edit the individual pages of the tutorial.

Save your changes and create a pull request as explained below.

## New content and complex changes
## New content and complex changes {#new-content-and-complex-changes}

For adding new chapters, writing longer snippets of text or adding images, you need to get a copy of the tutorial to your local computer.

Expand Down Expand Up @@ -132,8 +134,28 @@ Example:
To git@github.com:miohtama/tutorial.git
b37ca59..fe36152 contributing -> contributing

# Making a [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)
# Restructuring the tutorial {#restructuring-the-tutorial}
Restructuring the tutorial is a major change that takes time so we have created a separate branch for these changes.

To make contributions that address issues
[1777](https://github.com/DjangoGirls/tutorial/issues/1777) and [1792](https://github.com/DjangoGirls/tutorial/issues/1792),
[fork](#fork-the-repository) the repository your repository.

Next you need to follow instructions for [cloning and setting up locally given in the section above](#new-content-and-complex-changes).

Please make use of ["semantic linefeeds"](https://rhodesmill.org/brandon/2012/one-sentence-per-line/) a.k.a.
["semantic line breaks"](https://sembr.org/) for all paragraphs.
Though most of the Django Girls tutorial wasn't originally written that way, placing source line breaks at semantically meaningful spots in the text (and especially between sentences) facilitates both, commenting on individual statements or thoughts in the text as part of the review process, as well as future editing and diff-ing.

As we restructure the tutorial, this would be a great change to introduce to the tutorial so please make sure the chapter you work on follow this pattern.

All pull requests for changes aimed at restructuring the tutorial which address the issues
[1777](https://github.com/DjangoGirls/tutorial/issues/1777) and [1792](https://github.com/DjangoGirls/tutorial/issues/1792)
should be made to the `restructure-tutorial`.

All other steps for creating a pull request are the same as those outlined in the section on [making a pull request below](#making-a-pull-request), just make sure you make the pull request against the `restructure-tutorial` branch.

# Making a pull request {#making-a-pull-request}
After you have finished your changes you need to [create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) on GitHub. DjangoGirls will get notified about the pull request, review your changes, suggest any corrections if needed and then *pull* your changes to the master version.

In your own repository on GitHub press do *Compare & pull request*
Expand Down
3 changes: 0 additions & 3 deletions bg/GLOSSARY.md

This file was deleted.

51 changes: 0 additions & 51 deletions bg/README.md

This file was deleted.

35 changes: 0 additions & 35 deletions bg/SUMMARY.md

This file was deleted.

5 changes: 0 additions & 5 deletions bg/chromebook_setup/README.md

This file was deleted.

Loading
Loading