.github/workflows/update.yml #7341
This file contains hidden or 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
on: | |
schedule: | |
- cron: '17 * * * *' | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- uses: astral-sh/setup-uv@v5 | |
- uses: actions/checkout@v4 | |
- run: sudo apt-get install -y gettext | |
- run: pip install -r requirements.txt | |
- run: uv run generate.py # generates index.html and index.json | |
- run: mkdir -p build && cp index.* style.css build | |
- name: Deploy 🚀 | |
if: github.event_name != 'pull_request' | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: build | |
clean: false | |
git-config-name: github-actions[bot] | |
git-config-email: 41898282+github-actions[bot]@users.noreply.github.com | |
- name: Deploy to subdirectory if pull request 🚀 | |
# This does not work for PRs from forks | |
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: build | |
target-folder: ${{ github.ref_name }} | |
clean: false | |
git-config-name: github-actions[bot] | |
git-config-email: 41898282+github-actions[bot]@users.noreply.github.com | |
- name: Update PR description if pull request | |
# This does not work for PRs from forks | |
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork | |
uses: chabroA/action-append-pr-description@v1.2.1 | |
with: | |
auth: ${{ secrets.GITHUB_TOKEN }} | |
repo: ${{ github.event.repository.name }} | |
owner: ${{ github.repository_owner }} | |
pr: ${{ github.event.number }} | |
url: "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ github.ref_name }}/" | |
message: "📊 Dashboard preview 📊:" | |
- name: Debug index.html if pull request | |
if: github.event_name == 'pull_request' | |
run: | | |
curl -Lo index.html-public https://github.com/python-docs-translations/dashboard/raw/refs/heads/gh-pages/index.html | |
diff --color=always -u index.html-public index.html || : | |
cat index.html | |
- run: uv run generate_metadata.py # generates metadata.html | |
- run: cp metadata.html warnings* build | |
- name: Deploy metadata view 🚀 | |
if: github.event_name != 'pull_request' | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: build | |
clean: false | |
git-config-name: github-actions[bot] | |
git-config-email: 41898282+github-actions[bot]@users.noreply.github.com | |
- name: Deploy metadata view to subdirectory if pull request 🚀 | |
if: github.event_name == 'pull_request' | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: build | |
target-folder: ${{ github.ref_name }} | |
clean: false | |
git-config-name: github-actions[bot] | |
git-config-email: 41898282+github-actions[bot]@users.noreply.github.com | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: build |