forked from Mellanox/network-operator-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd6f25c
commit dd101ff
Showing
2 changed files
with
36 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,20 +6,22 @@ on: | |
git_tag: | ||
type: string | ||
description: The git tag (version) from the calling workflow | ||
required: true | ||
|
||
workflow_dispatch: | ||
inputs: | ||
git_tag: | ||
type: string | ||
description: The git tag (version) to use for `$TAG` | ||
required: true | ||
|
||
jobs: | ||
docs-ci: | ||
runs-on: ubuntu-latest | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }} | ||
TAG: ${{ inputs.git_tag }} | ||
REF_NAME: ${{ github.ref_name }} | ||
REF_HEAD: ${{ github.head_ref }} | ||
PR_NUMBER: ${{ github.event.number }} | ||
PR_TITLE_PREFIX: "task: update documentation for" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -32,6 +34,17 @@ jobs: | |
go-version: 1.23.x | ||
- name: Make docs | ||
run: | | ||
if [[ -n $PR_NUMBER ]]; then | ||
export BRANCH=$REF_HEAD | ||
echo "REF_NAME=$REF_HEAD" >> $GITHUB_ENV | ||
echo "COMMIT_SUFFIX=pull/$PR_NUMBER" >> $GITHUB_ENV | ||
else | ||
TAG="${TAG:-$REF_NAME}" | ||
export TAG | ||
echo "TAG=$TAG" >> $GITHUB_ENV | ||
echo "COMMIT_SUFFIX=$TAG" >> $GITHUB_ENV | ||
fi | ||
make api-docs helm-docs generate-docs-versions-var | ||
- name: Close any existing documentation PRs | ||
run: | | ||
|
@@ -40,23 +53,23 @@ jobs: | |
done | ||
- name: Create PR | ||
env: | ||
DOWNSTREAM_REPO_OWNER: nvidia-ci-cd | ||
DOWNSTREAM_FEATURE_BRANCH: update-docs-for-${{ env.TAG }} | ||
UPSTREAM_REPO_OWNER: Mellanox | ||
REF_NAME: ${{ github.ref_name }} | ||
DOWNSTREAM_REPO_OWNER: heyvister1 | ||
DOWNSTREAM_FEATURE_BRANCH: update-docs-for-${{ env.REF_NAME }} | ||
UPSTREAM_REPO_OWNER: heyvister1 | ||
UPSTREAM_DEFAULT_BRANCH: main | ||
COMMIT_MESSAGE: ${{ env.PR_TITLE_PREFIX }} ${{ env.TAG }} | ||
run: | | ||
git config user.name nvidia-ci-cd | ||
git config user.email [email protected] | ||
git config user.name heyvister1 | ||
git config user.email [email protected] | ||
gh repo fork --remote --default-branch-only | ||
gh repo sync $DOWNSTREAM_REPO_OWNER/network-operator-docs --source $UPSTREAM_REPO_OWNER/network-operator-docs --branch $UPSTREAM_DEFAULT_BRANCH | ||
git checkout -b $DOWNSTREAM_FEATURE_BRANCH | ||
git status | ||
git add docs | ||
COMMIT_MESSAGE="$PR_TITLE_PREFIX $COMMIT_SUFFIX" | ||
git commit -m "$COMMIT_MESSAGE" | ||
git push -u origin $DOWNSTREAM_FEATURE_BRANCH | ||
git push -u origin $DOWNSTREAM_FEATURE_BRANCH --force | ||
gh pr create \ | ||
--head $DOWNSTREAM_REPO_OWNER:$DOWNSTREAM_FEATURE_BRANCH \ | ||
--base $UPSTREAM_DEFAULT_BRANCH \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters