From 56e061a7244bc047cb3bde8e94c4cdcf71211de4 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 13 Nov 2025 16:49:39 -0800 Subject: [PATCH 1/2] [CI] Attempt to fix update-website.yml --- .github/workflows/update-website.yml | 18 +++++++++++------- .gitignore | 3 +++ tools/maint/update_docs.py | 25 +++++++++++++++++++++---- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/.github/workflows/update-website.yml b/.github/workflows/update-website.yml index 42e139daa33ad..711fef0e28019 100644 --- a/.github/workflows/update-website.yml +++ b/.github/workflows/update-website.yml @@ -10,7 +10,7 @@ jobs: name: Update website runs-on: ubuntu-latest env: - GH_TOKEN: ${{ secrets.EMSCRIPTEN_BOT_TOKEN }} + GITHUB_TOKEN: ${{ secrets.EMSCRIPTEN_BOT_TOKEN }} steps: - name: Checkout repo uses: actions/checkout@v4 @@ -23,6 +23,7 @@ jobs: repository: kripken/emscripten-site ref: gh-pages path: site/emscripten-site + token: ${{ secrets.EMSCRIPTEN_BOT_TOKEN }} - name: pip install run: | which python3 @@ -30,9 +31,10 @@ jobs: python3 -m pip install -r requirements-dev.txt - name: Update docs run: | - git config user.name emscripten-bot - git config user.email emscripten-bot@users.noreply.github.com - ./bootstrap + set -o errexit + set -o xtrace + git config --global user.name emscripten-bot + git config --global user.email emscripten-bot@users.noreply.github.com if ./tools/maint/update_docs.py; then echo "rebaseline_tests returned zero, expectations up-to-date" # Exit early and don't create a PR @@ -46,6 +48,8 @@ jobs: fi # Create a PR against the emscripten-site repo cd site/emscripten-site - git push origin update - gh pr create --fill --base gh-pages --reviewer sbc100,kripken - gh pr merge --squash --auto + git push -f origin update + gh pr create --fill --head update --base gh-pages --reviewer sbc100,kripken + # TODO: add --auto here once we have the review requirment in place + # for PR to the -site repo + gh pr merge --squash # --auto diff --git a/.gitignore b/.gitignore index 558e31c0b3b46..ad5d47d87d615 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,9 @@ coverage.xml # Test output /out/ +# When updating thr website we check it out here. +/site/emscripten-site/ + # Windows ps1 launchers (created by ./tools/maint/create_entry_points.py) *.ps1 # ...except the templates. diff --git a/tools/maint/update_docs.py b/tools/maint/update_docs.py index d485abd0d6907..16e8351fe4c20 100755 --- a/tools/maint/update_docs.py +++ b/tools/maint/update_docs.py @@ -15,11 +15,24 @@ root_dir = os.path.dirname(os.path.dirname(script_dir)) site_dir = os.path.join(root_dir, 'site') +message_template = '''\ +Automatic update of the emscripten website + +This is an automated change generated by `tools/maint/update_docs.py` in the emscripten repo. + +The change was generated at git revision https://github.com/emscripten-core/emscripten/commit/%s +''' + def is_git_clean(dirname): return subprocess.check_output(['git', 'status', '-uno', '--porcelain'], text=True, cwd=dirname).strip() == '' +def get_changed_files(dirname): + files_changed = subprocess.check_output(['git', 'status', '-uno', '--porcelain'], text=True, cwd=dirname).splitlines() + return [line[3:].strip() for line in files_changed] + + def main(args): if args: site_out = args[0] @@ -42,17 +55,21 @@ def main(args): # Build and install the docs subprocess.check_call(['make', 'install', f'EMSCRIPTEN_SITE={site_out}'], cwd=site_dir) - if is_git_clean(site_out): + files_changed = get_changed_files(site_dir) + # This AUTHORS.html file happens to always contains the current date, so we don't want + # to consider updates that contain only this one file + if 'docs/contributing/AUTHORS.html' in files_changed: + files_changed.remove('docs/contributing/AUTHORS.html') + + if not files_changed: print('docs are up-to-date; no changes found') return 0 # Create a new branch and commit the changes. subprocess.check_call(['git', 'checkout', '-b', 'update'], cwd=site_out) subprocess.check_call(['git', 'add', '.'], cwd=site_out) - hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'], text=True, cwd=root_dir).strip() - message = 'Update emscripten website\n\n' - message += f'These docs were generated based on git revision {hash}' + message = message_template % hash subprocess.run(['git', 'commit', '-F', '-'], input=message, text=True, cwd=site_out) return 2 From f25445cc7dcbf1d77e3e67ba2731dff9e67b1c81 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 14 Nov 2025 16:14:35 -0800 Subject: [PATCH 2/2] Update .gitignore Co-authored-by: Alon Zakai --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ad5d47d87d615..b759663ab3016 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,7 @@ coverage.xml # Test output /out/ -# When updating thr website we check it out here. +# When updating the website we check it out here. /site/emscripten-site/ # Windows ps1 launchers (created by ./tools/maint/create_entry_points.py)