Skip to content

Commit dde31f1

Browse files
committed
Add --force flag to sync_lineage for recompilation
1 parent 15d1af8 commit dde31f1

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

.github/workflows/publish-essay.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
description: "Knots lineage name"
1212
required: true
1313
type: string
14+
force:
15+
description: "Force recompilation of all versions"
16+
required: false
17+
type: boolean
18+
default: false
1419

1520
jobs:
1621
publish:
@@ -37,7 +42,7 @@ jobs:
3742
sudo apt-get install -y -qq pandoc
3843
3944
- name: Sync lineage
40-
run: python build/sync_lineage.py "${{ inputs.essay_id }}" git@github.com:codex-journal/source_engineering.git "${{ inputs.lineage }}"
45+
run: python build/sync_lineage.py "${{ inputs.essay_id }}" git@github.com:codex-journal/source_engineering.git "${{ inputs.lineage }}" ${{ inputs.force == true && '--force' || '' }}
4146

4247
- name: Rebuild index
4348
run: python build/build_index.py

build/sync_lineage.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,19 @@ def copy_latest_to_root(essay_id):
172172

173173

174174
def main():
175-
if len(sys.argv) != 4:
176-
print(f"Usage: {sys.argv[0]} <essay-id> <source-repo-url> <lineage>",
177-
file=sys.stderr)
178-
sys.exit(1)
179-
180-
essay_id = sys.argv[1]
181-
repo_url = sys.argv[2]
182-
lineage = sys.argv[3]
175+
import argparse
176+
parser = argparse.ArgumentParser(description="Sync essay lineage")
177+
parser.add_argument("essay_id", help="Essay directory name")
178+
parser.add_argument("repo_url", help="Source repo URL")
179+
parser.add_argument("lineage", help="Knots lineage name")
180+
parser.add_argument("--force", action="store_true",
181+
help="Force recompilation of all versions")
182+
args = parser.parse_args()
183+
184+
essay_id = args.essay_id
185+
repo_url = args.repo_url
186+
lineage = args.lineage
187+
force = args.force
183188

184189
print(f"Syncing {essay_id} from {lineage}")
185190

@@ -198,15 +203,15 @@ def main():
198203
compiled = already_compiled(essay_id, version)
199204
registered = version_in_registry(essay_id, version)
200205

201-
if compiled and registered:
206+
if compiled and registered and not force:
202207
continue
203208

204209
print(f"\n--- {version} ---")
205210
with tempfile.TemporaryDirectory() as dest:
206211
if not extract_version(git_dir, tree_sha, lineage, version, dest):
207212
print(f" Error extracting {version}", file=sys.stderr)
208213
continue
209-
if not compiled:
214+
if not compiled or force:
210215
if not compile_version(dest, essay_id, version):
211216
continue
212217
if not registered:

0 commit comments

Comments
 (0)