Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/fetch-sfs-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

- name: Process JSON files to Markdown files with Selex tags
run: |
python sfs_processor.py --input sfs_json --output SFS --formats md-markers
python sfs_processor.py --input sfs_json --output output/md --formats md-markers
env:
PYTHONPATH: ${{ github.workspace }}

Expand All @@ -60,7 +60,7 @@ jobs:
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)

# Create a new branch for commits if we have changes
git add SFS/ sfs_json/
git add output/md/ sfs_json/
if git diff --staged --quiet; then
echo "Inga nya filer att committa"
echo "has_changes=false" >> $GITHUB_OUTPUT
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/html-export-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ jobs:
- name: Generate HTML export
run: |
if [ -n "${{ inputs.filter }}" ]; then
python sfs_processor.py --input sfs_json --output SFS --formats html --filter "${{ inputs.filter }}"
python sfs_processor.py --input sfs_json --output output/html --formats html --filter "${{ inputs.filter }}"
else
python sfs_processor.py --input sfs_json --output SFS --formats html
python sfs_processor.py --input sfs_json --output output/html --formats html
fi
env:
PYTHONPATH: ${{ github.workspace }}
Expand Down Expand Up @@ -89,9 +89,9 @@ jobs:
aws configure set region us-east-1
aws configure set output json

- name: Upload SFS folder to Cloudflare R2
- name: Upload HTML folder to Cloudflare R2
run: |
aws s3 sync SFS/ s3://${{ secrets.CLOUDFLARE_R2_BUCKET_NAME }}/sfs/ \
aws s3 sync output/html/ s3://${{ secrets.CLOUDFLARE_R2_BUCKET_NAME }}/sfs/ \
--endpoint-url https://${{ secrets.CLOUDFLARE_R2_ACCOUNT_ID }}.r2.cloudflarestorage.com \
--delete \
--cache-control "public, max-age=3600" \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testdocs-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ jobs:

- name: Process test JSON files to Markdown files
run: |
python sfs_processor.py --input data/testdocs/rkrattsbaser --output SFS --formats md,md-markers,git
python sfs_processor.py --input data/testdocs/rkrattsbaser --output output/md --formats md,md-markers,git
env:
PYTHONPATH: ${{ github.workspace }}
6 changes: 3 additions & 3 deletions .github/workflows/upcoming-changes-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Run upcoming changes script
run: |
# Kör scriptet på markdown-katalogen för att uppdatera kommande.yaml
python temporal/upcoming_changes.py SFS/
python temporal/upcoming_changes.py output/md/
env:
PYTHONPATH: ${{ github.workspace }}

Expand All @@ -42,7 +42,7 @@ jobs:
# Detta gör att vi kan hämta ikapp missade dagar om jobbet misslyckats
eval $(python temporal/get_temporal_date_range.py)
echo "Bearbetar temporal commits från $FROM_DATE till $TO_DATE"
python scripts/temporal_commits_batch.py SFS/ --from-date "$FROM_DATE" --to-date "$TO_DATE" --verbose
python scripts/temporal_commits_batch.py output/md/ --from-date "$FROM_DATE" --to-date "$TO_DATE" --verbose
env:
PYTHONPATH: ${{ github.workspace }}
GIT_GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -55,7 +55,7 @@ jobs:
- name: Commit and push kommande.yaml updates
run: |
# Lägg till den uppdaterade kommande.yaml filen
git add data/kommande.yaml
git add output/kommande.yaml

if git diff --staged --quiet; then
echo "Inga ändringar i kommande.yaml"
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ htmlcov/

# Ignore output files
logs/
output/
sfs-output/
data/kommande.yaml
output/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pip install -r requirements.txt
Konvertera JSON-filer med författningar till Markdown:

```bash
python sfs_processor.py --input sfs_json --output SFS --formats md-markers
python sfs_processor.py --input sfs_json --output output/md --formats md-markers
```

## Output-format
Expand Down Expand Up @@ -73,7 +73,7 @@ Nedladdade filer sparas som standard i katalogen `sfs_docs`. Du kan ange annan k
Konvertera alla JSON-filer i en katalog till Markdown:

```bash
python sfs_processor.py --input sfs_json --output SFS --formats md-markers
python sfs_processor.py --input sfs_json --output output/md --formats md-markers
```

### Struktur av genererade Markdown-filer
Expand Down Expand Up @@ -175,7 +175,7 @@ För att se hur en lag såg ut vid ett specifikt datum:

```bash
# Se hur lagen såg ut 2023-01-01
python sfs_processor.py --input sfs_json --output SFS --formats md --target-date 2023-01-01
python sfs_processor.py --input sfs_json --output output/md --formats md --target-date 2023-01-01
```

Detta är användbart för att skapa historiska versioner eller för att förstå hur lagen såg ut vid en viss tidpunkt.
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ omit = [
".venv/*",
"venv/*",
"sfs_docs/*",
"SFS/*",
"output/*",
]

Expand Down
2 changes: 1 addition & 1 deletion sfs_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def main():
output_dir = script_dir.parent / f'sfs-export-{primary_format}'

# Create output directory if it doesn't exist
output_dir.mkdir(exist_ok=True)
output_dir.mkdir(parents=True, exist_ok=True)

# Check if json directory exists
if not json_dir.exists():
Expand Down
4 changes: 2 additions & 2 deletions temporal/upcoming_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

## Output Format

The module generates a YAML file at `data/kommande.yaml` with the following structure:
The module generates a YAML file at `output/kommande.yaml` with the following structure:

```yaml
'2025-01-15':
Expand Down Expand Up @@ -60,7 +60,7 @@
from typing import List, Dict, Optional
from pathlib import Path

UPCOMING_CHANGES_FILE_PATH = "data/kommande.yaml"
UPCOMING_CHANGES_FILE_PATH = "output/kommande.yaml"



Expand Down