66 git_tag :
77 type : string
88 description : The git tag (version) from the calling workflow
9- gh_docs_token :
10- type : string
11- description : Assigned nvidia-ci-cd PAT with docs repo r/w pull request permissions
12-
9+ required : true
1310 workflow_dispatch :
1411 inputs :
1512 git_tag :
1613 type : string
1714 description : The git tag (version) to use for `$TAG`
15+ required : true
1816
1917jobs :
2018 docs-ci :
2119 runs-on : ubuntu-latest
2220 env :
23- GH_TOKEN : ${{ inputs.gh_docs_token }}
24- # keeping TAG for cases docs repo workflow is triggered with tag input
21+ GH_TOKEN : ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }}
2522 TAG : ${{ inputs.git_tag }}
26- REF_NAME : ${{ github.ref_name }}
27- # in case of pushed PR, ref_head specifies PR's branch
28- REF_HEAD : ${{ github.head_ref }}
29- # will be used to specify repo tar url according to PR id
30- PR_NUMBER : ${{ github.event.number }}
3123 PR_TITLE_PREFIX : " task: update documentation for"
3224 steps :
3325 - uses : actions/checkout@v4
3426 with :
3527 repository : ${{ github.repository_owner }}/network-operator-docs # repo must be explicitly set here for workflow calling to behave correctly
36- token : ${{ inputs.token || inputs.gh_docs_token }}
28+ token : ${{ inputs.token || secrets.GH_TOKEN_NVIDIA_CI_CD }} # token must be explicitly set here for push to work in following step
3729 - name : Setup Go
38303931 with :
4032 go-version : 1.23.x
4133 - name : Make docs
42- # handle triggered workflow by pushed tag or PR
4334 run : |
44- if [[ -n $PR_NUMBER ]]; then
45- export BRANCH=$REF_HEAD
46- echo "REF_NAME=$REF_HEAD" >> $GITHUB_ENV
47- echo "COMMIT_SUFFIX=pull/$PR_NUMBER" >> $GITHUB_ENV
48- else
49- TAG="${TAG:-$REF_NAME}"
50- export TAG
51- echo "TAG=$TAG" >> $GITHUB_ENV
52- echo "COMMIT_SUFFIX=$TAG" >> $GITHUB_ENV
53- fi
54-
5535 make api-docs helm-docs generate-docs-versions-var
5636 - name : Close any existing documentation PRs
5737 run : |
@@ -60,23 +40,23 @@ jobs:
6040 done
6141 - name : Create PR
6242 env :
63- REF_NAME : ${{ github.ref_name }}
6443 DOWNSTREAM_REPO_OWNER : nvidia-ci-cd
65- DOWNSTREAM_FEATURE_BRANCH : update-docs-for-${{ env.REF_NAME }}
44+ DOWNSTREAM_FEATURE_BRANCH : update-docs-for-${{ env.TAG }}
6645 UPSTREAM_REPO_OWNER : Mellanox
6746 UPSTREAM_DEFAULT_BRANCH : main
47+ COMMIT_MESSAGE : ${{ env.PR_TITLE_PREFIX }} ${{ env.TAG }}
6848 run : |
69- git config user.name nvidia-ci-cd
49+ git config user.name nvidia-ci-cd
7050 git config user.email [email protected] 71- export GH_TOKEN=${{ env.GH_TOKEN }}
51+ gh repo fork --remote --default-branch-only
52+ gh repo sync $DOWNSTREAM_REPO_OWNER/${{ github.event.repository.name }} --source $UPSTREAM_REPO_OWNER/${{ github.event.repository.name }} --branch $UPSTREAM_DEFAULT_BRANCH
7253
73- gh repo sync $DOWNSTREAM_REPO_OWNER/network-operator-docs --source $UPSTREAM_REPO_OWNER/network-operator-docs --branch $UPSTREAM_DEFAULT_BRANCH
7454 git checkout -b $DOWNSTREAM_FEATURE_BRANCH
55+ git status
7556 git add docs
76- COMMIT_MESSAGE="$PR_TITLE_PREFIX $COMMIT_SUFFIX"
7757 git commit -m "$COMMIT_MESSAGE"
7858
79- git push -u origin $DOWNSTREAM_FEATURE_BRANCH --force
59+ git push -u origin $DOWNSTREAM_FEATURE_BRANCH
8060 gh pr create \
8161 --head $DOWNSTREAM_REPO_OWNER:$DOWNSTREAM_FEATURE_BRANCH \
8262 --base $UPSTREAM_DEFAULT_BRANCH \
0 commit comments