Skip to content

Commit 5caed08

Browse files
committed
Fixing issues with transformation and adding version to branch
1 parent 40e89c3 commit 5caed08

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

.github/workflows/devportal-update.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ jobs:
3535
pip install PyYAML
3636
chmod -R +x ${{ env.DEV_PORTAL_SCRIPT_PATH }}/process_docs.py
3737
38+
- name: Extract version from gradle.properties
39+
run: |
40+
VERSION=$(tr -d "'\"" < rskj-core/src/main/resources/version.properties | cut -d = -f 2- | paste -sd - -)
41+
echo "RSK_VERSION=${VERSION}" >> $GITHUB_ENV
42+
3843
# Step 1: Clone the Devportal Repository
3944
- name: Clone Devportal Repository
4045
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
@@ -49,10 +54,9 @@ jobs:
4954
GITHUB_TOKEN: ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}
5055
run: |
5156
cd devportal
52-
TIMESTAMP=$(date +'%Y%m%d-%H%M%S')
53-
BRANCH_NAME="update-from-rskj-${TIMESTAMP}"
57+
BRANCH_NAME="update-from-rskj-${{ env.RSK_VERSION }}"
5458
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
55-
git checkout -b ${BRANCH_NAME} || git checkout ${BRANCH_NAME}
59+
git checkout -b ${BRANCH_NAME} || git checkout ${BRANCH_NAME}
5660
cd ..
5761
5862
# Step 3: Transform Each File and Copy to Devportal Repository
@@ -78,7 +82,7 @@ jobs:
7882
git commit -m "Automated update from rskj repository"
7983
git remote set-url origin https://x-access-token:${{ env.GITHUB_TOKEN }}@github.com/rsksmart/devportal.git
8084
echo "Pushing branch: ${{ env.BRANCH_NAME }}"
81-
git push -u origin ${{ env.BRANCH_NAME }}
85+
git push -u -f origin ${{ env.BRANCH_NAME }}
8286
8387
# Step 5: Create a Pull Request in the Devportal Repository
8488
- name: Create Pull Request

.github/workflows/scripts/devportal-update/process_docs.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def process_doc_file(input_file, output_file, sidebar_label, sidebar_position, t
2222
outfile.write(f"sidebar_label: {sidebar_label}\n")
2323
outfile.write(f"sidebar_position: {sidebar_position}\n")
2424
outfile.write(f"title: {title}\n")
25-
outfile.write(f"tags: {tags}\n")
26-
outfile.write(f"description: {description}\n")
25+
outfile.write(f"tags: {yaml.dump(tags, default_flow_style=True).strip()}\n")
26+
outfile.write(f"description: \"{description}\"\n")
2727
outfile.write("---\n\n")
2828
outfile.writelines(content)
2929

@@ -47,7 +47,7 @@ def main(config_file):
4747
sidebar_position = entry['sidebar_position']
4848
title = entry['title']
4949
description = entry['description']
50-
tags = ', '.join(entry['tags'])
50+
tags = entry['tags']
5151

5252
log(f"Processing: {input_file} -> {output_file}")
5353
if process_doc_file(input_file, output_file, sidebar_label, sidebar_position, title, description, tags):

0 commit comments

Comments
 (0)