Skip to content

Commit cce83b9

Browse files
doc: Fix doc publish failure
There was a wrong path for comment.txt. Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
1 parent 283a98a commit cce83b9

2 files changed

Lines changed: 18 additions & 21 deletions

File tree

.github/workflows/doc_build.yml

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,31 +110,28 @@ jobs:
110110
mv "${MONITOR}" "$PUBLISH"
111111
if [[ -f pr.txt ]]; then mv pr.txt "$PUBLISH"; fi
112112
113-
- name: Find Matter add-on edited documents
114-
if: github.event_name == 'pull_request'
115-
run: |
116-
PUBLISH="docs/publish"
117-
mkdir -p "$PUBLISH"
118-
COMMENT="${PUBLISH}/comment.txt"
119-
PREFIX="${{ vars.NCS_DOC_PR_HOSTING_URL }}addons/${{ env.DOC_ADDON_NAME }}/PR-${{ github.event.pull_request.number }}/"
120-
CHANGED=$(git diff --name-only --diff-filter=d "${{ github.event.pull_request.base.sha }}..HEAD")
113+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
114+
COMMENT="${PUBLISH}/comment.txt"
115+
PREFIX="${{ vars.NCS_DOC_PR_HOSTING_URL }}addons/${{ env.DOC_ADDON_NAME }}/PR-${{ github.event.pull_request.number }}/"
116+
CHANGED=$(git diff --name-only --diff-filter=d "${{ github.event.pull_request.base.sha }}..HEAD")
121117
122-
echo "You can find the documentation preview for this PR [here](${PREFIX})." > "${COMMENT}"
118+
echo "You can find the documentation preview for this PR [here](${PREFIX})." > "${COMMENT}"
123119
124-
DOCS=$(echo "$CHANGED" | \
125-
grep -e "^docs/" | \
126-
grep -e ".rst$" | \
127-
sed -e "s#^docs\(.*\)\.rst#${PREFIX}\1.html#g")
120+
DOCS=$(echo "$CHANGED" | \
121+
grep -e "^docs/" | \
122+
grep -e ".rst$" | \
123+
sed -e "s#^docs\(.*\)\.rst#${PREFIX}\1.html#g" || true)
128124
129-
SAMPLES=$(echo "$CHANGED" | \
130-
grep -e "^samples/" | \
131-
grep -e ".rst$" | \
132-
sed -e "s#^samples\(.*\)\.rst#${PREFIX}samples\1.html#g")
125+
SAMPLES=$(echo "$CHANGED" | \
126+
grep -e "^samples/" | \
127+
grep -e ".rst$" | \
128+
sed -e "s#^samples\(.*\)\.rst#${PREFIX}samples\1.html#g" || true)
133129
134-
DOCS_ALL=$(printf "%s\n%s" "$DOCS" "$SAMPLES" | sed '/^$/d')
130+
DOCS_ALL=$(printf "%s\n%s" "$DOCS" "$SAMPLES" | sed '/^$/d')
135131
136-
if [ -n "$DOCS_ALL" ]; then
137-
printf "\nPreview links for modified Matter add-on documents:\n\n%s" "$DOCS_ALL" >> "${COMMENT}"
132+
if [ -n "$DOCS_ALL" ]; then
133+
printf "\nPreview links for modified Matter add-on documents:\n\n%s" "$DOCS_ALL" >> "${COMMENT}"
134+
fi
138135
fi
139136
140137
- name: Store

.github/workflows/doc_publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,5 @@ jobs:
7878
with:
7979
comment-id: ${{ steps.fc.outputs.comment-id }}
8080
issue-number: ${{ env.PR }}
81-
body-path: comment.txt
81+
body-path: docs/comment.txt
8282
edit-mode: replace

0 commit comments

Comments
 (0)