66 git_tag :
77 type : string
88 description : The git tag (version) from the calling workflow
9- required : true
9+
1010 workflow_dispatch :
1111 inputs :
1212 git_tag :
1313 type : string
1414 description : The git tag (version) to use for `$TAG`
15- required : true
1615
1716jobs :
1817 docs-ci :
1918 runs-on : ubuntu-latest
2019 env :
2120 GH_TOKEN : ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }}
2221 TAG : ${{ inputs.git_tag }}
22+ REF_NAME : ${{ github.ref_name }}
23+ REF_HEAD : ${{ github.head_ref }}
24+ PR_NUMBER : ${{ github.event.number }}
2325 PR_TITLE_PREFIX : " task: update documentation for"
2426 steps :
2527 - uses : actions/checkout@v4
3234 go-version : 1.23.x
3335 - name : Make docs
3436 run : |
37+ if [[ -n $PR_NUMBER ]]; then
38+ export BRANCH=$REF_HEAD
39+ echo "REF_NAME=$REF_HEAD" >> $GITHUB_ENV
40+ echo "COMMIT_SUFFIX=pull/$PR_NUMBER" >> $GITHUB_ENV
41+ else
42+ TAG="${TAG:-$REF_NAME}"
43+ export TAG
44+ echo "TAG=$TAG" >> $GITHUB_ENV
45+ echo "COMMIT_SUFFIX=$TAG" >> $GITHUB_ENV
46+ fi
47+
3548 make api-docs helm-docs generate-docs-versions-var
3649 - name : Close any existing documentation PRs
3750 run : |
@@ -40,23 +53,23 @@ jobs:
4053 done
4154 - name : Create PR
4255 env :
43- DOWNSTREAM_REPO_OWNER : nvidia-ci-cd
44- DOWNSTREAM_FEATURE_BRANCH : update-docs-for-${{ env.TAG }}
45- UPSTREAM_REPO_OWNER : Mellanox
56+ REF_NAME : ${{ github.ref_name }}
57+ DOWNSTREAM_REPO_OWNER : heyvister1
58+ DOWNSTREAM_FEATURE_BRANCH : update-docs-for-${{ env.REF_NAME }}
59+ UPSTREAM_REPO_OWNER : heyvister1
4660 UPSTREAM_DEFAULT_BRANCH : main
47- COMMIT_MESSAGE : ${{ env.PR_TITLE_PREFIX }} ${{ env.TAG }}
4861 run : |
49- git config user.name nvidia-ci-cd
50- git config user.email [email protected] 62+ git config user.name heyvister1
63+ git config user.email [email protected] 64+
5165 gh repo fork --remote --default-branch-only
5266 gh repo sync $DOWNSTREAM_REPO_OWNER/network-operator-docs --source $UPSTREAM_REPO_OWNER/network-operator-docs --branch $UPSTREAM_DEFAULT_BRANCH
53-
5467 git checkout -b $DOWNSTREAM_FEATURE_BRANCH
55- git status
5668 git add docs
69+ COMMIT_MESSAGE="$PR_TITLE_PREFIX $COMMIT_SUFFIX"
5770 git commit -m "$COMMIT_MESSAGE"
5871
59- git push -u origin $DOWNSTREAM_FEATURE_BRANCH
72+ git push -u origin $DOWNSTREAM_FEATURE_BRANCH --force
6073 gh pr create \
6174 --head $DOWNSTREAM_REPO_OWNER:$DOWNSTREAM_FEATURE_BRANCH \
6275 --base $UPSTREAM_DEFAULT_BRANCH \
0 commit comments