From bc7054837d2187e87c439195bee1508ca6f2c883 Mon Sep 17 00:00:00 2001 From: vladimirhasko Date: Mon, 11 Aug 2025 15:24:27 +0000 Subject: [PATCH] adding different method for changed files --- .gitea/workflows/convert-html-docs.yaml | 51 ++++++++++++++++++++----- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/convert-html-docs.yaml b/.gitea/workflows/convert-html-docs.yaml index db74dc815..1c29d3310 100644 --- a/.gitea/workflows/convert-html-docs.yaml +++ b/.gitea/workflows/convert-html-docs.yaml @@ -124,6 +124,7 @@ jobs: print(doc_exports_var) json_str = json.dumps(doc_exports_var, indent=4) json_str = "doc_exports_var=" + json_str + print(json_str) with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: fh.write(json_str) @@ -136,17 +137,47 @@ jobs: ls -la ./doc_exports_var.json cat ./doc_exports_var.json - - name: Get last git changed files - id: git_log +# - name: Get last git changed files +# id: git_log +# run: | +# cd $PROJECT_SRC_DIR +# ls +# echo > ../changed_files.txt +# git branch +# git status +# git log -1 --name-only --pretty= > ../changed_files.txt || true +# cat ../changed_files.txt +# cat ../doc_exports_var.json + + + - name: Install jq + run: sudo apt-get update && sudo apt-get install -y jq + + - name: Debug event file run: | - cd $PROJECT_SRC_DIR - ls - echo > ../changed_files.txt - git branch - git status - git log -1 --name-only --pretty= > ../changed_files.txt || true - cat ../changed_files.txt - cat ../doc_exports_var.json + echo "Gitea event file path: $GITEA_EVENT_PATH" + cat "$GITEA_EVENT_PATH" + + - name: List changed files in PR + id: changed_files + run: | + PR_NUMBER=$(jq -r .pull_request.number "$GITEA_EVENT_PATH") + REPO=$(jq -r .repository.full_name "$GITEA_EVENT_PATH") + + echo "PR #$PR_NUMBER from repo $REPO" + + # Extract owner and repo name + OWNER=$(echo "$REPO" | cut -d'/' -f1) + REPO_NAME=$(echo "$REPO" | cut -d'/' -f2) + + # Use Gitea API to get changed files + # Requires an API token with repo read access + curl -s -H "Authorization: token ${{ secrets.TEST_TOKEN }}" \ + "https://gitea.eco.tsi-dev.otc-service.com/api/v1/repos/$OWNER/$REPO_NAME/pulls/$PR_NUMBER/files" \ + | jq -r '.[].filename' > changed_files.txt + + echo "Changed files:" + cat changed_files.txt - name: Generate RST docs run: |