docs/.github/workflows/content-changes-table-comme...

102 строки
4.1 KiB
YAML
Исходник Ответственный История

Этот файл содержит невидимые символы Юникода!

Этот файл содержит невидимые символы Юникода, которые могут быть отображены не так, как показано ниже. Если это намеренно, можете спокойно проигнорировать это предупреждение. Используйте кнопку Экранировать, чтобы показать скрытые символы.

Этот файл содержит неоднозначные символы Юникода, которые могут быть перепутаны с другими в текущей локали. Если это намеренно, можете спокойно проигнорировать это предупреждение. Используйте кнопку Экранировать, чтобы подсветить эти символы.

name: Content Changes Table Comment
# **What it does**: When a PR is opened in docs-internal or docs, it adds the staging preview and live article links in a Content Directory Changes table in a comment
# **Why we have it**: To help Docs Content team members and contributors automatically have their staging/live article links added to the table
# **Who does it impact**: docs-internal/docs maintainers and contributors
on:
workflow_dispatch:
pull_request_target:
permissions:
contents: read
pull-requests: write
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
PR-Preview-Links:
if: github.event.pull_request.user.login != 'Octomerger'
name: Add staging/live links to PR
runs-on: ubuntu-latest
outputs:
filterContentDir: ${{ steps.filter.outputs.filterContentDir }}
steps:
- name: Get files changed
uses: dorny/paths-filter@eb75a1edc117d3756a18ef89958ee59f9500ba58
id: filter
with:
# Base branch used to get changed files
base: ${{ github.event.pull_request.base.ref }}
# Enables setting an output in the format in `${FILTER_NAME}_files
# with the names of the matching files formatted as JSON array
list-files: json
# Returns list of changed files matching each filter
filters: |
filterContentDir:
- 'content/**/*'
filterContentDir:
needs: PR-Preview-Links
if: ${{ needs.PR-Preview-Links.outputs.filterContentDir == 'true' }}
runs-on: ubuntu-latest
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
steps:
- name: check out repo content
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- name: Get preview app info
env:
APP_NAME_SEED: ${{ secrets.PREVIEW_ENV_NAME_SEED }}
run: .github/actions-scripts/get-preview-app-info.sh
- name: Setup Node
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561
with:
node-version: 16.14.x
cache: npm
- name: Install temporary dependencies
run: |
npm install --no-save github-slugger --registry https://registry.npmjs.org/
- name: Get changes table
id: changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APP_URL: ${{ env.APP_URL }}
run: .github/actions-scripts/content-changes-table-comment.js
- name: Find content directory changes comment
uses: peter-evans/find-comment@d2dae40ed151c634e4189471272b57e76ec19ba8
id: findComment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- MODIFIED_CONTENT_LINKING_COMMENT -->'
- name: Update comment
uses: peter-evans/create-or-update-comment@5221bf4aa615e5c6e95bb142f9673a9c791be2cd
with:
comment-id: ${{ steps.findComment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
<!-- MODIFIED_CONTENT_LINKING_COMMENT -->
## Automatically generated comment
**This comment is automatically generated and will be overwritten every time changes are committed to this branch.**
The table contains an overview of files in the `content` directory that have been changed in this pull request. It's provided to make it easy to review your changes on the staging site. Please note that changes to the `data` directory will not show up in this table.
---
### Content directory changes
_You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request._
${{ steps.changes.outputs.changesTable }}
edit-mode: replace