Skip to content

feat: ChangelogModal Component #126

feat: ChangelogModal Component

feat: ChangelogModal Component #126

Workflow file for this run

# This Workflow is used to comment on PRs that have changes that touch Translated Files
# and then comments on their PRs mentioning that they should not do so
name: Crowdin Checks
on:
pull_request_target:
branches:
- main
paths:
- 'pages/**/*.md'
- 'pages/**/*.mdx'
- '!pages/en/**/*.md'
- '!pages/en/**/*.mdx'
- 'i18n/locales/*.json'
- '!i18n/locales/en.json'
permissions:
# This permission is required by `stefanzweifel/git-auto-commit-action`
contents: write
actions: read
# This permission is required by `thollander/actions-comment-pull-request`
pull-requests: write
jobs:
comment_on_translation_pr:
# This comment should only be posted on PRs that come from users and not from Crowdin
if: |
github.event.pull_request.head.repo.full_name == 'nodejs/nodejs.org' &&
github.event.pull_request.head.ref != 'chore/crowdin'
name: Comment on Translation PR
runs-on: ubuntu-latest
steps:
- uses: thollander/actions-comment-pull-request@1d3973dc4b8e1399c0620d3f2b1aa5e795465308 # v2.4.3
with:
message: |
> [!NOTE]\
> Your Pull Request seems to be updating **Translations** of the Node.js Website.
>
> Whilst we appreciate your intent; Any Translation update should be done through our [Crowdin Project](https://crowdin.com/project/nodejs-web).
> We recommend giving a read on our [Translation Guidelines](https://github.com/nodejs/nodejs.org/blob/main/TRANSLATION.md).
>
> Thank you!
comment_tag: use_crowdin
format_crowdin_pull_request:
# We should only run the automated Format Command on Crowdin-based Pull Requests
if: |
github.event.pull_request.head.repo.full_name == 'nodejs/nodejs.org' &&
github.event.pull_request.head.ref == 'chore/crowdin'
name: Format Crowdin Pull Request
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
# By default Git Checkout on `pull-request-target` will checkout
# the `default` branch of the Pull Request. We want to checkout
# the actual branch of the Pull Request.
ref: ${{ github.event.pull_request.head.ref }}
- name: Restore Lint Cache
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: |
.eslintmdcache
.prettiercache
# We want to restore Turborepo Cache and ESlint and Prettier Cache
# The ESLint and Prettier cache's are useful to reduce the overall runtime of ESLint and Prettier
# as they will only run on files that have changed since the last cached run
# this might of course lead to certain files not being checked against the linter, but the chances
# of such situation from happening are very slim as the checksums of both files would need to match
key: cache-lint-${{ hashFiles('package-lock.json') }}-
restore-keys: |
cache-lint-${{ hashFiles('package-lock.json') }}-
cache-lint-
- name: Set up Node.js
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
# We want to ensure that the Node.js version running here respects our supported versions
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install NPM packages
# We want to avoid NPM from running the Audit Step and Funding messages on a CI environment
# We also use `npm i` instead of `npm ci` so that the node_modules/.cache folder doesn't get deleted
run: npm i --no-audit --no-fund --ignore-scripts --userconfig=/dev/null
- name: Run `npx lint:md --fix`
# This runs a specific version of ESLint with only the Translation Pages Globbing
# This avoid that unrelated changes get linted/modified within this PR
run: npx eslint "pages/**/*.md?(x)" --fix --cache --cache-strategy=metadata --cache-file=.eslintmdcache
- name: Run `npx prettier --write`
# This runs a specific version of Prettier with only the Translation Pages Globbing
# This avoid that unrelated changes get prettied/modified within this PR
run: npx prettier "{pages,i18n}/**/*.{json,md,mdx}" --check --write --cache --cache-strategy=metadata --cache-location=.prettiercache
- name: Push Changes back to Pull Request
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5.0.0
with:
commit_options: '--no-verify --signoff'
commit_message: 'chore: automated format of translated files'
- name: Save Lint Cache
uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: |
.eslintmdcache
.prettiercache
key: cache-lint-${{ hashFiles('package-lock.json') }}-${{ hashFiles('.eslintmdcache') }}