Skip to content

Commit dd101ff

Browse files
committed
testing github flows
1 parent bd6f25c commit dd101ff

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

.github/workflows/docs-ci.yaml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@ on:
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

1716
jobs:
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
@@ -32,6 +34,17 @@ jobs:
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 \

Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,21 @@ export PATH:=$(GOBIN):${PATH}
1414
BRANCH ?= master
1515
TAG ?=
1616
# Then using TAG, the tar file starts with v, but the extracted dir does not
17-
SRC := $(shell echo $(if $(TAG),$(TAG),$(BRANCH)) | sed 's/^v//')
17+
ifdef PR_NUMBER
18+
SRC = refs-pull-$(PR_NUMBER)-head
19+
REFS_NAME = pull/$(PR_NUMBER)
20+
else ifdef TAG
21+
SRC = $(shell echo $(TAG) | sed 's/^v//')
22+
REFS_NAME=tags/$(TAG)
23+
else
24+
SRC = $(BRANCH)
25+
REFS_NAME=$(BRANCH)
26+
endif
1827

1928
# Network Operator source tar location
20-
REPO_TAR_URL ?= https://github.com/Mellanox/network-operator/archive/refs/$(if $(TAG),tags/$(TAG),heads/$(BRANCH)).tar.gz
29+
REPO_TAR_URL ?= https://github.com/heyvister1/network-operator/archive/refs/$(REFS_NAME)/head.tar.gz
2130
# release.yaml location
22-
RELEASE_YAML_URL ?= https://raw.githubusercontent.com/Mellanox/network-operator/$(if $(TAG),$(TAG),$(BRANCH))/hack/release.yaml
31+
RELEASE_YAML_URL ?= https://raw.githubusercontent.com/heyvister1/network-operator/$(if $(TAG),$(TAG),$(BRANCH))/hack/release.yaml
2332

2433
# Path to download the crd api to.
2534
CRD_API_DEP_ROOT = $(BUILDDIR)/crd

0 commit comments

Comments
 (0)