1414 deploy :
1515 runs-on : ubuntu-latest
1616 steps :
17- - uses : actions/checkout@v2
18- - uses : actions/setup-python@v2
17+ - uses : actions/checkout@v4
18+ - uses : actions/setup-python@v4
1919 with :
2020 python-version : 3.x
2121 - run : cp proto/apidocs.swagger.json docs/reference/apidocs.json
@@ -29,19 +29,39 @@ jobs:
2929 update-docs :
3030 runs-on : ubuntu-latest
3131 steps :
32- - uses : actions/checkout@v2
32+ - uses : actions/checkout@v4
3333 with :
3434 fetch-depth : 0
3535 - name : Update Gitlab Documentation
36+ env :
37+ GITLAB_TOKEN : ${{ secrets.GITLAB_TOKEN }}
38+ GITLAB_USER : ${{ secrets.GITLAB_USER }}
39+ GITLAB_EMAIL : ${{ secrets.GITLAB_EMAIL }}
40+ GITLAB_DOCS_REPO_URL : ${{ secrets.GITLAB_DOCS_REPO_URL }}
3641 run : |
37- GL_BRANCH_NAME="documentation-ref_$GITHUB_SHA "
42+ GL_BRANCH_NAME="main "
3843 cd ..
39- git clone ${{ secrets.GITLAB_DOC_URL }}
40- cd docs
41- git config user.name ${{ secrets.GITLAB_USER }}
42- git config user.email ${{ secrets.GITLAB_EMAIL }}
43- cp ../maestro/**/*.md .
44- git checkout -b $GL_BRANCH_NAME
44+
45+ # Clone using service account credentials with HTTPS URL
46+ git clone "https://${GITLAB_USER}:${GITLAB_TOKEN}@${GITLAB_DOCS_REPO_URL}" gitlab-docs
47+ cd gitlab-docs
48+
49+ # Configure git with service account identity
50+ git config user.name "${GITLAB_USER}"
51+ git config user.email "${GITLAB_EMAIL}"
52+
53+ # Copy everything under docs/ directory while preserving directory structure
54+ rsync -av ../maestro/docs/ ./
55+
56+ # Check if there are any changes to commit
57+ if git diff --quiet && git diff --cached --quiet; then
58+ echo "No changes to documentation files, skipping push"
59+ exit 0
60+ fi
61+
62+ # Create branch and commit changes
4563 git add .
46- git commit --allow-empty -m "Created by $GITHUB_ACTOR"
64+ git commit -m "Auto-update documentation from GitHub (SHA: ${GITHUB_SHA:0:7})" -m "Triggered by: $GITHUB_ACTOR"
4765 git push origin $GL_BRANCH_NAME
66+
67+ echo "Documentation updated and pushed to branch: $GL_BRANCH_NAME"
0 commit comments