Repository navigation
Repo sync #414
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 features | |
| # Fails feature-deletion PRs because translations still use deleted English features. | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'data/features/**' | |
| - .github/workflows/dont-delete-features.yml | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| dont-delete-features: | |
| if: github.event.pull_request.user.login != 'docs-bot' && github.event.pull_request.user.login != 'docs-engineering-bot[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-features-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_FEATURES -->' | |
| - name: Update comment | |
| if: ${{ steps.comment.outputs.markdown != '' }} | |
| # Fork PRs get a read-only token, so posting fails there. The next step still shows the instructions. | |
| continue-on-error: true | |
| 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 != '' }} | |
| env: | |
| MARKDOWN: ${{ steps.comment.outputs.markdown }} | |
| run: | | |
| echo "This PR deletes or renames one or more feature files." | |
| echo "See the PR comment or this job's summary for how to get them back." | |
| echo "$MARKDOWN" >> "$GITHUB_STEP_SUMMARY" | |
| echo "$MARKDOWN" | |
| exit 1 |