@@ -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
0 commit comments