Repository navigation
Repo sync #744
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Don't delete assets | |
| # Fails asset-deletion PRs because translations still reference deleted English assets. | |
| # The comment script exempts generated copilot-sdk assets that sync pipelines recreate. | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'assets/**' | |
| - '.github/workflows/dont-delete-assets.yml' | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| dont-delete-assets: | |
| # The Orphaned files check workflow opens docs-bot PRs that delete assets on purpose. | |
| if: github.event.pull_request.user.login != 'docs-bot' && (github.repository == 'github/docs-internal' || github.repository == 'github/docs') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: ./.github/actions/node-npm-setup | |
| - name: Get comment markdown | |
| id: comment | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npm run deleted-assets-pr-comment | |
| - name: Find possible previous comment | |
| if: ${{ steps.comment.outputs.markdown != '' }} | |
| uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad | |
| id: findComment | |
| with: | |
| issue-number: ${{ github.event.number }} | |
| comment-author: 'github-actions[bot]' | |
| body-includes: '<!-- DELETED_ASSETS -->' | |
| - name: Update comment | |
| if: ${{ steps.comment.outputs.markdown != '' }} | |
| uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 | |
| with: | |
| comment-id: ${{ steps.findComment.outputs.comment-id }} | |
| issue-number: ${{ github.event.number }} | |
| body: ${{ steps.comment.outputs.markdown }} | |
| edit-mode: replace | |
| - name: Ultimately fail the workflow for attention | |
| if: ${{ steps.comment.outputs.markdown != '' }} | |
| run: | | |
| echo "More than 1 asset image was deleted as part of this PR." | |
| echo "See posted PR commented about how to get them back." | |
| exit 1 |