Skip to content

Commit

Permalink
Handle wiki repo not found
Browse files Browse the repository at this point in the history
fixes #2
  • Loading branch information
rsyring committed Jul 22, 2024
1 parent cad2cbb commit d716133
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/wiki-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ name: Docs <-> Wiki

on:
push:
branches:
# Name a branch "docs-preview" if you want commits to the branch to apply to the wiki
# immediately. Helpful if you want to make multiple updates, preview them, merge commits, etc.
# before finally merging to master.
- docs-preview
# The the above exception, doc updates will only by synced to the wiki when merged to the
# default branch. Change this to your default branch name, e.g. "master"
- main
paths:
- "wiki/**"
- ".github/workflows/**"
Expand Down Expand Up @@ -37,6 +29,6 @@ jobs:
# run: echo "$GITHUB_CONTEXT"

- name: GitHub Wiki Sync
uses: level12/gh-action-wiki-sync@main
uses: level12/gh-action-wiki-sync@$GITHUB_REF_NAME
with:
github_token: ${{ github.token }}
12 changes: 10 additions & 2 deletions src/wiki-sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from os import environ
from pathlib import Path
import shutil
import subprocess
import sys

import click
Expand Down Expand Up @@ -69,10 +70,17 @@ def main(print_wiki_repo: bool | None):
if print_wiki_repo:
fail('Only printing wiki repo')

sub_run('git', 'clone', '--single-branch', '--depth=1', wiki_repo, tmp_wiki_dpath)

ws_git = Git(workspace_dpath)
wiki_git = Git(tmp_wiki_dpath)

try:
sub_run('git', 'clone', '--single-branch', '--depth=1', wiki_repo, tmp_wiki_dpath)
except subprocess.CalledProcessError as e:
stderr = e.stderr.decode('utf-8')
if 'Repository not found' not in stderr:
raise
ws_git('init')

if is_gh_action:
ws_git.safe()
wiki_git.safe()
Expand Down

0 comments on commit d716133

Please sign in to comment.