1
0
mirror of synced 2025-12-30 03:01:36 -05:00

Revert "fix: show content table preview urls after deploy" (#29853)

This commit is contained in:
Rachael Sewell
2022-08-11 09:53:59 -07:00
committed by GitHub
parent 1101941834
commit a60db5d2b9
2 changed files with 5 additions and 23 deletions

View File

@@ -2,7 +2,6 @@
import * as github from '@actions/github'
import { setOutput } from '@actions/core'
import got from 'got'
import { getContents } from '../../script/helpers/git-utils.js'
import parse from '../../lib/read-frontmatter.js'
@@ -48,13 +47,6 @@ const articleFiles = files.filter(
const lines = await Promise.all(
articleFiles.map(async (file) => {
// Action triggered on PR and after preview env is deployed. Check health to determine if preview env is ready (healthy)
let appUrlIsHealthy = false
try {
const res = await got.head(`${APP_URL}/healthz`, { retry: { limit: 0 } })
appUrlIsHealthy = res.statusCode === 200
} catch (err) {}
const sourceUrl = file.blob_url
const fileName = file.filename.slice(pathPrefix.length)
const fileUrl = fileName.slice(0, fileName.lastIndexOf('.'))
@@ -78,8 +70,7 @@ const lines = await Promise.all(
const { data } = parse(fileContents)
let contentCell = ''
let previewCell = appUrlIsHealthy ? '' : '_Deployment pending..._'
let previewCell = ''
let prodCell = ''
if (file.status === 'added') contentCell = 'New file: '
@@ -107,16 +98,12 @@ const lines = await Promise.all(
if (versions.toString() === nonEnterpriseDefaultVersion) {
// omit version from fpt url
previewCell += appUrlIsHealthy ? `[${plan}](${APP_URL}/${fileUrl})<br>` : ''
previewCell += `[${plan}](${APP_URL}/${fileUrl})<br>`
prodCell += `[${plan}](${PROD_URL}/${fileUrl})<br>`
} else {
// for non-versioned releases (ghae, ghec) use full url
if (appUrlIsHealthy) {
previewCell += appUrlIsHealthy
? `[${plan}](${APP_URL}/${versions}/${fileUrl})<br>`
: ''
}
previewCell += `[${plan}](${APP_URL}/${versions}/${fileUrl})<br>`
prodCell += `[${plan}](${PROD_URL}/${versions}/${fileUrl})<br>`
}
} else if (versions.length) {
@@ -126,9 +113,7 @@ const lines = await Promise.all(
prodCell += `${plan}@ `
versions.forEach((version) => {
previewCell += appUrlIsHealthy
? `[${version.split('@')[1]}](${APP_URL}/${version}/${fileUrl}) `
: ''
previewCell += `[${version.split('@')[1]}](${APP_URL}/${version}/${fileUrl}) `
prodCell += `[${version.split('@')[1]}](${PROD_URL}/${version}/${fileUrl}) `
})
previewCell += '<br>'

View File

@@ -5,10 +5,6 @@ name: Content Changes Table Comment
# **Who does it impact**: docs-internal/docs maintainers and contributors
on:
# Trigger this workflow after preview deployment runs
workflow_run:
workflows:
- Azure - Deploy Preview Environment
workflow_dispatch:
pull_request_target:
@@ -44,6 +40,7 @@ jobs:
filters: |
filterContentDir:
- 'content/**/*'
filterContentDir:
needs: PR-Preview-Links
if: ${{ needs.PR-Preview-Links.outputs.filterContentDir == 'true' }}