chore: update angular-cli monorepo to v21.0.2 #880
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
| # This workflow is used to augment the capabilities of the renovate | |
| # GitHub app by updating the native event names that are sourced from | |
| # the `@mdn/browser-compat-data` package whenever that dependency is updated. | |
| name: Renovate Update Native Event Names | |
| on: | |
| # NOTE: Never use pull_request_target here because that would populate secrets for forks | |
| # Renovate creates branches directly on the main repo and acts like a trusted contributor | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'pnpm-workspace.yaml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.number || github.ref }} | |
| cancel-in-progress: true | |
| # Minimal permissions by default | |
| permissions: | |
| contents: read | |
| jobs: | |
| maybe_update_native_event_names: | |
| # Only run if it was the renovate bot that triggered the workflow (otherwise we'll create a loop) | |
| if: contains('["renovate[bot]"]', github.actor) == true | |
| name: Update if required | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| # To allow us to perform the git diff we need the git history | |
| fetch-depth: 0 | |
| # To ensure we can push from a different user (and therefore cause actions to rerun) | |
| persist-credentials: false | |
| - name: Check if @mdn/browser-compat-data was changed as part of the latest commit by renovate bot on the PR | |
| id: relevant-packages-check | |
| uses: ./.github/actions/check-package-changes | |
| with: | |
| packages: | | |
| @mdn/browser-compat-data:.catalog["@mdn/browser-compat-data"] | |
| - uses: pnpm/action-setup@v4 | |
| if: ${{ steps.relevant-packages-check.outputs.was-changed == 'true' }} | |
| name: Install pnpm | |
| with: | |
| run_install: false | |
| - name: Install Node.js per package.json | |
| if: ${{ steps.relevant-packages-check.outputs.was-changed == 'true' }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| # Use the volta.node property as the source of truth | |
| node-version-file: 'package.json' | |
| - name: Update native event names if @mdn/browser-compat-data was changed and commit the changes | |
| if: ${{ steps.relevant-packages-check.outputs.was-changed == 'true' }} | |
| env: | |
| # We cannot use secrets.GITHUB_TOKEN for this because it is not permitted to kick off subsequent actions workflow runs, so we use a fine-grained PAT instead | |
| GITHUB_TOKEN: ${{ secrets.GH_FINE_GRAINED_PAT }} | |
| run: | | |
| # Checkout the PR branch using the github CLI | |
| gh pr checkout ${{ github.event.pull_request.number }} | |
| pnpm install --ignore-scripts | |
| # Reset any changes that happened before updating the event names (e.g. to the pnpm-workspace.yaml and lock file) so that we don't commit them | |
| git reset --hard | |
| # Regenerate the file containing the event names | |
| pnpm update-native-event-names | |
| # Commit all event name changes to the PR (see note on not being able to use secrets.GITHUB_TOKEN for this) | |
| git config --global user.email "james@henry.sc" | |
| git config --global user.name "JamesHenry" | |
| git remote set-url origin https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git | |
| # Check if there are any changes to commit after regenerating the event names | |
| if git diff --quiet; then | |
| echo "No native event name changes detected" | |
| else | |
| # Add everything that changed after generating the event names | |
| git add --all | |
| git commit -m "chore: update native event names" | |
| git push | |
| fi |