@@ -49,57 +49,12 @@ jobs:
4949 - name : Install temporary dependencies
5050 run : |
5151 npm install --no-save github-slugger
52- npm install --no-save --include=optional esm
5352
5453 - name : Get changes table
55- uses : actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
5654 id : changes
5755 env :
5856 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
59- with :
60- script : |
61- // Workaround to allow us to load ESM files with `require(...)`
62- const esm = require('esm')
63- require = esm({})
64-
65- const { default: createStagingAppName } = require('./script/deployment/create-staging-app-name')
66-
67- const stagingPrefix = createStagingAppName({
68- repo: context.payload.repository.name,
69- pullNumber: context.payload.number,
70- branch: context.payload.pull_request.head.ref,
71- })
72-
73- const response = await github.repos.compareCommits({
74- owner: context.repo.owner,
75- repo: context.repo.repo,
76- base: context.payload.pull_request.base.sha,
77- head: context.payload.pull_request.head.sha
78- })
79-
80- const files = response.data.files
81-
82- let markdownTable = '| **Source** | **Staging** | **Production** | **What Changed** |\n|:----------- |:----------- |:----------- |:----------- |\n'
83-
84- const pathPrefix = 'content/'
85- const articleFiles = files.filter(({ filename }) => filename.startsWith(pathPrefix) && !filename.endsWith('/index.md'))
86- for (const file of articleFiles) {
87- const sourceUrl = file.blob_url
88- const fileName = file.filename.slice(pathPrefix.length)
89- const fileUrl = fileName.slice(0, fileName.lastIndexOf('.'))
90- const stagingLink = `https://${stagingPrefix}.herokuapp.com/${fileUrl}`
91- const productionLink = `https://docs.github.com/${fileUrl}`
92- let markdownLine = ''
93-
94- if (file.status === 'modified') {
95- markdownLine = `| [content/${fileName}](${sourceUrl}) | [Modified](${stagingLink}) | [Original](${productionLink}) | |\n`
96- } else if (file.status === 'added') {
97- markdownLine = `| New file: [content/${fileName}](${sourceUrl}) | [Modified](${stagingLink}) | | |\n`
98- }
99- markdownTable += markdownLine
100- }
101-
102- core.setOutput('changesTable', markdownTable)
57+ run : .github/actions-scripts/content-changes-table-comment.js
10358
10459 - name : Find content directory changes comment
10560 uses : peter-evans/find-comment@d2dae40ed151c634e4189471272b57e76ec19ba8
0 commit comments