Add github_code/freeCodeCamp__freeCodeCamp from GitHub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- github_code/freeCodeCamp__freeCodeCamp/.devcontainer/codespace-env.sh +23 -0
- github_code/freeCodeCamp__freeCodeCamp/.devcontainer/devcontainer.json +51 -0
- github_code/freeCodeCamp__freeCodeCamp/.devcontainer/docker-compose.yml +33 -0
- github_code/freeCodeCamp__freeCodeCamp/.devcontainer/on-create.sh +8 -0
- github_code/freeCodeCamp__freeCodeCamp/.devcontainer/post-create.sh +30 -0
- github_code/freeCodeCamp__freeCodeCamp/.devcontainer/post-start.sh +43 -0
- github_code/freeCodeCamp__freeCodeCamp/.devcontainer/welcome.sh +17 -0
- github_code/freeCodeCamp__freeCodeCamp/.dockerignore +11 -0
- github_code/freeCodeCamp__freeCodeCamp/.editorconfig +16 -0
- github_code/freeCodeCamp__freeCodeCamp/.gitattributes +15 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/.well-known/funding-manifest-urls +1 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/CODEOWNERS +36 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/FUNDING.yml +3 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/ISSUE_TEMPLATE/01--issues-with-coding-challenges.yml +61 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/ISSUE_TEMPLATE/02--issues-with-software-on-platforms.yml +60 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/ISSUE_TEMPLATE/03--issues-with-content-on-articles-and-docs.yml +41 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/ISSUE_TEMPLATE/04--feature-request-for-freecodecamp-org-s-platforms.yml +29 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/ISSUE_TEMPLATE/config.yml +11 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/PULL_REQUEST_TEMPLATE.md +14 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/actions/setup-turbo-cache/action.yml +75 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/copilot-instructions.md +186 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/instructions/testing.instructions.md +98 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/labeler.yml +26 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/scripts/pr-guidelines/check-allow-list.js +24 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/scripts/pr-guidelines/check-pr-template.js +39 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/scripts/pr-guidelines/fix-pr-title.js +79 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/scripts/pr-guidelines/report-results.js +83 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/crowdin-download.client-ui.yml +342 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/crowdin-upload.client-ui.yml +55 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/crowdin-upload.curriculum.yml +80 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/curriculum-i18n-submodule.yml +78 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/deploy-api.yml +353 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/deploy-client.yml +393 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/devcontainer-ci.yml +112 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/docker-docr-cleanup.yml +35 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/docker-docr.yml +125 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/docker-ghcr.yml +50 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/e2e-playwright.yml +98 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/github-autoclose.yml +74 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/github-labeler.yaml +24 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/github-lock-closed-prs.yml +24 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/github-no-i18n-via-prs.yml +34 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/github-pr-guidelines.yml +209 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/github-spam.yml +27 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/i18n-validate-builds.yml +50 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/i18n-validate-prs.yml +61 -0
- github_code/freeCodeCamp__freeCodeCamp/.github/workflows/node.js-tests.yml +357 -0
- github_code/freeCodeCamp__freeCodeCamp/.gitignore +206 -0
- github_code/freeCodeCamp__freeCodeCamp/.gitmodules +8 -0
- github_code/freeCodeCamp__freeCodeCamp/.husky/pre-commit +1 -0
github_code/freeCodeCamp__freeCodeCamp/.devcontainer/codespace-env.sh
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
cd "$(dirname "$0")/.."
|
| 5 |
+
|
| 6 |
+
[[ -n "${CODESPACE_NAME:-}" ]] || exit 0
|
| 7 |
+
|
| 8 |
+
set_env() {
|
| 9 |
+
local key=$1 value=$2 tmp
|
| 10 |
+
tmp=$(mktemp)
|
| 11 |
+
trap 'rm -f "$tmp"' RETURN
|
| 12 |
+
awk -v k="$key" -v v="$value" '
|
| 13 |
+
index($0, k "=") == 1 { print k "=" v; found = 1; next }
|
| 14 |
+
{ print }
|
| 15 |
+
END { if (!found) print k "=" v }
|
| 16 |
+
' .env >"$tmp"
|
| 17 |
+
cat "$tmp" >.env
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
domain=${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN:-app.github.dev}
|
| 21 |
+
set_env HOME_LOCATION "https://${CODESPACE_NAME}-8000.${domain}"
|
| 22 |
+
set_env API_LOCATION "https://${CODESPACE_NAME}-3000.${domain}"
|
| 23 |
+
printf 'Codespace detected. HOME_LOCATION and API_LOCATION in .env now use %s.\n' "$domain"
|
github_code/freeCodeCamp__freeCodeCamp/.devcontainer/devcontainer.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "freeCodeCamp",
|
| 3 |
+
"dockerComposeFile": ["../docker/docker-compose.yml", "docker-compose.yml"],
|
| 4 |
+
"service": "devcontainer",
|
| 5 |
+
"workspaceFolder": "/workspaces/freeCodeCamp",
|
| 6 |
+
"hostRequirements": {
|
| 7 |
+
"cpus": 4,
|
| 8 |
+
"memory": "16gb",
|
| 9 |
+
"storage": "32gb"
|
| 10 |
+
},
|
| 11 |
+
"mounts": [
|
| 12 |
+
"source=fcc-node-modules,target=${containerWorkspaceFolder}/node_modules,type=volume"
|
| 13 |
+
],
|
| 14 |
+
"forwardPorts": [8000, 3000, 8025],
|
| 15 |
+
"portsAttributes": {
|
| 16 |
+
"8000": { "label": "Client", "onAutoForward": "notify" },
|
| 17 |
+
"3000": { "label": "API", "onAutoForward": "silent" },
|
| 18 |
+
"8025": { "label": "Mailpit", "onAutoForward": "silent" }
|
| 19 |
+
},
|
| 20 |
+
"otherPortsAttributes": { "onAutoForward": "silent" },
|
| 21 |
+
"onCreateCommand": ".devcontainer/on-create.sh",
|
| 22 |
+
"updateContentCommand": "pnpm install --prefer-offline",
|
| 23 |
+
// post-create.sh runs codespace-env.sh. That rewrite must not move to
|
| 24 |
+
// onCreateCommand: a prebuild snapshots the container after onCreateCommand
|
| 25 |
+
// and would freeze the wrong hostname.
|
| 26 |
+
"postCreateCommand": ".devcontainer/post-create.sh",
|
| 27 |
+
// Codespaces resets port visibility on stop, and postCreateCommand does
|
| 28 |
+
// not run again on a restart.
|
| 29 |
+
"postStartCommand": ".devcontainer/post-start.sh",
|
| 30 |
+
"postAttachCommand": ".devcontainer/welcome.sh",
|
| 31 |
+
"customizations": {
|
| 32 |
+
"vscode": {
|
| 33 |
+
"extensions": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"],
|
| 34 |
+
"settings": {
|
| 35 |
+
"tasks": {
|
| 36 |
+
"version": "2.0.0",
|
| 37 |
+
"tasks": [
|
| 38 |
+
{
|
| 39 |
+
"label": "Start freeCodeCamp",
|
| 40 |
+
"type": "shell",
|
| 41 |
+
"command": "pnpm run develop",
|
| 42 |
+
"isBackground": true,
|
| 43 |
+
"problemMatcher": [],
|
| 44 |
+
"presentation": { "reveal": "always", "panel": "dedicated" }
|
| 45 |
+
}
|
| 46 |
+
]
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/.devcontainer/docker-compose.yml
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: freecodecamp-devcontainer
|
| 2 |
+
|
| 3 |
+
services:
|
| 4 |
+
devcontainer:
|
| 5 |
+
image: ghcr.io/freecodecamp/devcontainer:latest
|
| 6 |
+
# gatsby develop defaults to host `localhost`. Where the network namespace
|
| 7 |
+
# has IPv6, glibc RFC 6724 precedence resolves that to ::1 first, so the
|
| 8 |
+
# dev server binds IPv6 loopback only and port forwarding, which connects
|
| 9 |
+
# over IPv4, is refused. 0.0.0.0 needs no AF_INET6 socket, so it also holds
|
| 10 |
+
# where IPv6 is switched off.
|
| 11 |
+
environment:
|
| 12 |
+
GATSBY_HOST: 0.0.0.0
|
| 13 |
+
volumes:
|
| 14 |
+
- ..:/workspaces/freeCodeCamp:cached
|
| 15 |
+
# Shares the db network namespace so MONGOHQ_URL and MAILPIT_HOST in
|
| 16 |
+
# sample.env resolve on localhost. A service in that namespace cannot
|
| 17 |
+
# publish a port, which is why the host ports live in a separate overlay.
|
| 18 |
+
network_mode: service:db
|
| 19 |
+
command: sleep infinity
|
| 20 |
+
depends_on:
|
| 21 |
+
db:
|
| 22 |
+
condition: service_healthy
|
| 23 |
+
setup:
|
| 24 |
+
condition: service_completed_successfully
|
| 25 |
+
mailpit:
|
| 26 |
+
condition: service_started
|
| 27 |
+
|
| 28 |
+
mailpit:
|
| 29 |
+
# Same namespace, for MAILPIT_HOST=localhost.
|
| 30 |
+
network_mode: service:db
|
| 31 |
+
depends_on:
|
| 32 |
+
db:
|
| 33 |
+
condition: service_healthy
|
github_code/freeCodeCamp__freeCodeCamp/.devcontainer/on-create.sh
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
cd "$(dirname "$0")/.."
|
| 5 |
+
|
| 6 |
+
sudo chown node:node node_modules
|
| 7 |
+
|
| 8 |
+
[[ -f .env ]] || cp sample.env .env
|
github_code/freeCodeCamp__freeCodeCamp/.devcontainer/post-create.sh
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
cd "$(dirname "$0")/.."
|
| 5 |
+
|
| 6 |
+
wait_for_primary() {
|
| 7 |
+
for _ in $(seq 1 30); do
|
| 8 |
+
if mongosh --quiet --eval 'if (!db.hello().isWritablePrimary) quit(1)' >/dev/null 2>&1; then
|
| 9 |
+
return 0
|
| 10 |
+
fi
|
| 11 |
+
sleep 2
|
| 12 |
+
done
|
| 13 |
+
return 1
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
rsync -a --include='*/' --include='.turbo/***' --exclude='*' /home/node/.cache/fcc/ ./
|
| 17 |
+
|
| 18 |
+
.devcontainer/codespace-env.sh
|
| 19 |
+
|
| 20 |
+
if ! wait_for_primary; then
|
| 21 |
+
printf 'MongoDB did not become writable. Run "docker compose ps" to inspect the services.\n' >&2
|
| 22 |
+
exit 1
|
| 23 |
+
fi
|
| 24 |
+
|
| 25 |
+
set -a
|
| 26 |
+
# shellcheck disable=SC1091
|
| 27 |
+
. ./.env
|
| 28 |
+
set +a
|
| 29 |
+
|
| 30 |
+
pnpm seed
|
github_code/freeCodeCamp__freeCodeCamp/.devcontainer/post-start.sh
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
# Runs on every start, including a resume. Codespaces resets port visibility
|
| 5 |
+
# when a codespace stops, and postCreateCommand does not run again.
|
| 6 |
+
[[ -n "${CODESPACE_NAME:-}" ]] || exit 0
|
| 7 |
+
|
| 8 |
+
for attempt in 1 2; do
|
| 9 |
+
status=0
|
| 10 |
+
err=$(timeout 20 gh codespace ports visibility 3000:public -c "$CODESPACE_NAME" 2>&1) || status=$?
|
| 11 |
+
|
| 12 |
+
if [[ $status -eq 0 ]]; then
|
| 13 |
+
printf 'Port 3000 is public, so the client can reach the API.\n'
|
| 14 |
+
printf 'Anybody with the URL can reach it, and the development sign-in\n'
|
| 15 |
+
printf 'route needs no password. Stop the codespace when you finish.\n'
|
| 16 |
+
exit 0
|
| 17 |
+
fi
|
| 18 |
+
|
| 19 |
+
if [[ $status -eq 124 ]]; then
|
| 20 |
+
err="gh timed out after 20 seconds"
|
| 21 |
+
fi
|
| 22 |
+
|
| 23 |
+
if [[ $status -eq 127 ]]; then
|
| 24 |
+
err="gh is not installed"
|
| 25 |
+
break
|
| 26 |
+
fi
|
| 27 |
+
|
| 28 |
+
if [[ $attempt -lt 2 ]]; then
|
| 29 |
+
sleep 5
|
| 30 |
+
fi
|
| 31 |
+
done
|
| 32 |
+
|
| 33 |
+
printf 'gh could not set the port: %s\n' "$err" >&2
|
| 34 |
+
cat <<'MSG'
|
| 35 |
+
|
| 36 |
+
Port 3000 is private, so the client cannot reach the API yet.
|
| 37 |
+
Open the Ports panel, right click port 3000, then choose Port Visibility,
|
| 38 |
+
then Public.
|
| 39 |
+
|
| 40 |
+
A public port is reachable by anybody who has the URL, and the development
|
| 41 |
+
sign-in route needs no password. Stop the codespace when you finish working.
|
| 42 |
+
|
| 43 |
+
MSG
|
github_code/freeCodeCamp__freeCodeCamp/.devcontainer/welcome.sh
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
cat <<'MSG'
|
| 5 |
+
|
| 6 |
+
freeCodeCamp is ready. Dependencies are installed, MongoDB is running,
|
| 7 |
+
and a test user is seeded.
|
| 8 |
+
|
| 9 |
+
Open a new terminal and start the development script:
|
| 10 |
+
|
| 11 |
+
pnpm run develop
|
| 12 |
+
|
| 13 |
+
Read the setup and troubleshooting guide before you begin:
|
| 14 |
+
|
| 15 |
+
https://contribute.freecodecamp.org/how-to-setup-freecodecamp-locally/
|
| 16 |
+
|
| 17 |
+
MSG
|
github_code/freeCodeCamp__freeCodeCamp/.dockerignore
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
client/.cache
|
| 2 |
+
client/public
|
| 3 |
+
.env
|
| 4 |
+
.git
|
| 5 |
+
.gitignore
|
| 6 |
+
.dockerignore
|
| 7 |
+
docker/**/Dockerfile
|
| 8 |
+
**/*docker-compose*
|
| 9 |
+
**/node_modules
|
| 10 |
+
.eslintcache
|
| 11 |
+
|
github_code/freeCodeCamp__freeCodeCamp/.editorconfig
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
root = true
|
| 2 |
+
|
| 3 |
+
[*]
|
| 4 |
+
indent_style = space
|
| 5 |
+
indent_size = 2
|
| 6 |
+
end_of_line = lf
|
| 7 |
+
charset = utf-8
|
| 8 |
+
trim_trailing_whitespace = true
|
| 9 |
+
insert_final_newline = true
|
| 10 |
+
|
| 11 |
+
[package.json]
|
| 12 |
+
indent_style = space
|
| 13 |
+
indent_size = 2
|
| 14 |
+
|
| 15 |
+
[*.md]
|
| 16 |
+
trim_trailing_whitespace = false
|
github_code/freeCodeCamp__freeCodeCamp/.gitattributes
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
* text=auto eol=lf
|
| 2 |
+
|
| 3 |
+
# These files are binary and should be left untouched
|
| 4 |
+
*.eot binary
|
| 5 |
+
*.gif binary
|
| 6 |
+
*.ico binary
|
| 7 |
+
*.jpeg binary
|
| 8 |
+
*.jpg binary
|
| 9 |
+
*.mov binary
|
| 10 |
+
*.mp3 binary
|
| 11 |
+
*.mp4 binary
|
| 12 |
+
*.pdf binary
|
| 13 |
+
*.png binary
|
| 14 |
+
*.ttf binary
|
| 15 |
+
*.woff binary
|
github_code/freeCodeCamp__freeCodeCamp/.github/.well-known/funding-manifest-urls
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
https://www.freecodecamp.org/funding.json
|
github_code/freeCodeCamp__freeCodeCamp/.github/CODEOWNERS
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -------------------------------------------------
|
| 2 |
+
# CODEOWNERS - For automated review request for
|
| 3 |
+
# high impact files.
|
| 4 |
+
#
|
| 5 |
+
# Important: The order in this file cascades.
|
| 6 |
+
#
|
| 7 |
+
# https://help.github.com/articles/about-codeowners
|
| 8 |
+
# -------------------------------------------------
|
| 9 |
+
|
| 10 |
+
# -------------------------------------------------
|
| 11 |
+
# Files that need attention from primary teams
|
| 12 |
+
# -------------------------------------------------
|
| 13 |
+
|
| 14 |
+
# --- All files
|
| 15 |
+
* @freecodecamp/dev-team @freecodecamp/curriculum
|
| 16 |
+
|
| 17 |
+
# --- Package files for negation ---
|
| 18 |
+
|
| 19 |
+
**/package.json @freecodecamp/none
|
| 20 |
+
**/pnpm-lock.yaml @freecodecamp/none
|
| 21 |
+
|
| 22 |
+
# -------------------------------------------------
|
| 23 |
+
# Files that need attention from i18n & dev team
|
| 24 |
+
# -------------------------------------------------
|
| 25 |
+
|
| 26 |
+
# i18n Quotes
|
| 27 |
+
**/motivation.json @freeCodeCamp/dev-team @freeCodeCamp/i18n
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
# -------------------------------------------------
|
| 31 |
+
# Files that need attention from the mobile team
|
| 32 |
+
# -------------------------------------------------
|
| 33 |
+
|
| 34 |
+
/client/src/redux/prop-types.ts @freeCodeCamp/dev-team @freeCodeCamp/mobile
|
| 35 |
+
/client/tools/external-curriculum/* @freeCodeCamp/dev-team @freeCodeCamp/mobile
|
| 36 |
+
/curriculum/schema/challenge-schema.js @freeCodeCamp/dev-team @freeCodeCamp/mobile
|
github_code/freeCodeCamp__freeCodeCamp/.github/FUNDING.yml
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
github: freecodecamp
|
| 2 |
+
patreon: freecodecamp
|
| 3 |
+
custom: [www.freecodecamp.org/donate]
|
github_code/freeCodeCamp__freeCodeCamp/.github/ISSUE_TEMPLATE/01--issues-with-coding-challenges.yml
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Issue - Content in our Coding Challenges
|
| 2 |
+
description: Report issues with a specific challenge, like broken tests, unclear instructions, etc.
|
| 3 |
+
type: Bug
|
| 4 |
+
labels: ['scope: curriculum', 'status: waiting triage']
|
| 5 |
+
body:
|
| 6 |
+
- type: markdown
|
| 7 |
+
attributes:
|
| 8 |
+
value: If you're reporting a security issue, don't create a GitHub issue. Instead, visit https://contribute.freecodecamp.org/#/security.
|
| 9 |
+
- type: textarea
|
| 10 |
+
attributes:
|
| 11 |
+
label: Describe the Issue
|
| 12 |
+
description: A clear and concise description of the issue you encountered.
|
| 13 |
+
validations:
|
| 14 |
+
required: true
|
| 15 |
+
- type: input
|
| 16 |
+
attributes:
|
| 17 |
+
label: Affected Page
|
| 18 |
+
description: Add a link to the coding challenge with the problem.
|
| 19 |
+
validations:
|
| 20 |
+
required: true
|
| 21 |
+
- type: textarea
|
| 22 |
+
attributes:
|
| 23 |
+
label: Your code
|
| 24 |
+
description: Copy and paste the code from the editor that you used in between the back-ticks.
|
| 25 |
+
value: |
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
```
|
| 31 |
+
validations:
|
| 32 |
+
required: true
|
| 33 |
+
- type: textarea
|
| 34 |
+
attributes:
|
| 35 |
+
label: Expected behavior
|
| 36 |
+
description: Add a clear and concise description of what you expected to happen.
|
| 37 |
+
validations:
|
| 38 |
+
required: true
|
| 39 |
+
- type: textarea
|
| 40 |
+
attributes:
|
| 41 |
+
label: Screenshots
|
| 42 |
+
description: If applicable, add screenshots to help explain your problem. You can drag and drop `png`, `jpg`, `gif`, etc. in this box.
|
| 43 |
+
validations:
|
| 44 |
+
required: false
|
| 45 |
+
- type: textarea
|
| 46 |
+
attributes:
|
| 47 |
+
label: System
|
| 48 |
+
description: Please complete the following information.
|
| 49 |
+
value: |
|
| 50 |
+
- Device: [e.g. iPhone 6, Laptop]
|
| 51 |
+
- OS: [e.g. iOS 14, Windows 10, Ubuntu 20.04]
|
| 52 |
+
- Browser: [e.g. Chrome, Safari]
|
| 53 |
+
- Version: [e.g. 22]
|
| 54 |
+
validations:
|
| 55 |
+
required: true
|
| 56 |
+
- type: textarea
|
| 57 |
+
attributes:
|
| 58 |
+
label: Additional context
|
| 59 |
+
description: Add any other context about the problem here.
|
| 60 |
+
validations:
|
| 61 |
+
required: false
|
github_code/freeCodeCamp__freeCodeCamp/.github/ISSUE_TEMPLATE/02--issues-with-software-on-platforms.yml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Issue - User Interface on our Platforms
|
| 2 |
+
description: Report a software bug on /learn, /news, Community Forum, Code Radio, or any of the platforms.
|
| 3 |
+
type: Bug
|
| 4 |
+
labels: ['status: waiting triage']
|
| 5 |
+
body:
|
| 6 |
+
- type: markdown
|
| 7 |
+
attributes:
|
| 8 |
+
value: If you're reporting a security issue, don't create a GitHub issue. Instead, visit https://contribute.freecodecamp.org/#/security.
|
| 9 |
+
- type: textarea
|
| 10 |
+
attributes:
|
| 11 |
+
label: Describe the Issue
|
| 12 |
+
description: A clear and concise description of the issue you encountered.
|
| 13 |
+
validations:
|
| 14 |
+
required: true
|
| 15 |
+
- type: input
|
| 16 |
+
attributes:
|
| 17 |
+
label: Affected Page
|
| 18 |
+
description: Add a link to the page with the problem.
|
| 19 |
+
validations:
|
| 20 |
+
required: true
|
| 21 |
+
- type: textarea
|
| 22 |
+
attributes:
|
| 23 |
+
label: Steps to Reproduce
|
| 24 |
+
description: Please provide the steps to reproduce the issue.
|
| 25 |
+
value: |
|
| 26 |
+
1. Go to '...'
|
| 27 |
+
2. Click on '...'
|
| 28 |
+
3. Scroll down to '...'
|
| 29 |
+
4. See error
|
| 30 |
+
validations:
|
| 31 |
+
required: true
|
| 32 |
+
- type: textarea
|
| 33 |
+
attributes:
|
| 34 |
+
label: Expected behavior
|
| 35 |
+
description: Add a clear and concise description of what you expected to happen.
|
| 36 |
+
validations:
|
| 37 |
+
required: true
|
| 38 |
+
- type: textarea
|
| 39 |
+
attributes:
|
| 40 |
+
label: Screenshots
|
| 41 |
+
description: If applicable, add screenshots to help explain your problem. You can drag and drop `png`, `jpg`, `gif`, etc. in this box.
|
| 42 |
+
validations:
|
| 43 |
+
required: false
|
| 44 |
+
- type: textarea
|
| 45 |
+
attributes:
|
| 46 |
+
label: System
|
| 47 |
+
description: Please complete the following information.
|
| 48 |
+
value: |
|
| 49 |
+
- Device: [e.g. iPhone 6, Laptop]
|
| 50 |
+
- OS: [e.g. iOS 14, Windows 10, Ubuntu 20.04]
|
| 51 |
+
- Browser: [e.g. Chrome, Safari]
|
| 52 |
+
- Version: [e.g. 22]
|
| 53 |
+
validations:
|
| 54 |
+
required: true
|
| 55 |
+
- type: textarea
|
| 56 |
+
attributes:
|
| 57 |
+
label: Additional context
|
| 58 |
+
description: Add any other context about the problem here.
|
| 59 |
+
validations:
|
| 60 |
+
required: false
|
github_code/freeCodeCamp__freeCodeCamp/.github/ISSUE_TEMPLATE/03--issues-with-content-on-articles-and-docs.yml
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Issues - Content in our Articles and other Documentation
|
| 2 |
+
description: Report issues with content on a specific article, like broken links, typos, missing parts, etc.
|
| 3 |
+
type: Bug
|
| 4 |
+
labels: ['status: waiting triage']
|
| 5 |
+
body:
|
| 6 |
+
- type: markdown
|
| 7 |
+
attributes:
|
| 8 |
+
value: 'NOTE: If you want to become an author on freeCodeCamp, you can find everything here: https://www.freecodecamp.org/news/developer-news-style-guide'
|
| 9 |
+
- type: markdown
|
| 10 |
+
attributes:
|
| 11 |
+
value: If you are reporting an issue with an article on our news publication, please follow this link to send an email to our editorial team https://mailxto.com/lkj5n7
|
| 12 |
+
- type: textarea
|
| 13 |
+
attributes:
|
| 14 |
+
label: Describe the Issue
|
| 15 |
+
description: A clear and concise description of the issue you encountered.
|
| 16 |
+
validations:
|
| 17 |
+
required: true
|
| 18 |
+
- type: input
|
| 19 |
+
attributes:
|
| 20 |
+
label: Affected Page
|
| 21 |
+
description: Add a link to the article or documentation page with the problem.
|
| 22 |
+
validations:
|
| 23 |
+
required: true
|
| 24 |
+
- type: textarea
|
| 25 |
+
attributes:
|
| 26 |
+
label: Steps to Reproduce
|
| 27 |
+
description: Please describe the problem and provide the steps to reproduce the issue.
|
| 28 |
+
validations:
|
| 29 |
+
required: true
|
| 30 |
+
- type: textarea
|
| 31 |
+
attributes:
|
| 32 |
+
label: Recommended fix or suggestions
|
| 33 |
+
description: A clear and concise description of how you want to update it.
|
| 34 |
+
validations:
|
| 35 |
+
required: true
|
| 36 |
+
- type: textarea
|
| 37 |
+
attributes:
|
| 38 |
+
label: Screenshots
|
| 39 |
+
description: If applicable, add screenshots to help explain your problem. You can drag and drop `png`, `jpg`, `gif`, etc. in this box.
|
| 40 |
+
validations:
|
| 41 |
+
required: false
|
github_code/freeCodeCamp__freeCodeCamp/.github/ISSUE_TEMPLATE/04--feature-request-for-freecodecamp-org-s-platforms.yml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: New Feature - Request a new feature for our Platforms
|
| 2 |
+
description: Suggest an idea for freeCodeCamp.org's /learn, /news, Community Forum, Code Radio, or other platforms.
|
| 3 |
+
type: Enhancement
|
| 4 |
+
labels: ['status: waiting triage']
|
| 5 |
+
body:
|
| 6 |
+
- type: textarea
|
| 7 |
+
attributes:
|
| 8 |
+
label: Is your feature request related to a problem? Please describe.
|
| 9 |
+
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
| 10 |
+
validations:
|
| 11 |
+
required: true
|
| 12 |
+
- type: textarea
|
| 13 |
+
attributes:
|
| 14 |
+
label: Describe the solution you'd like
|
| 15 |
+
description: A clear and concise description of what you want to happen.
|
| 16 |
+
validations:
|
| 17 |
+
required: true
|
| 18 |
+
- type: textarea
|
| 19 |
+
attributes:
|
| 20 |
+
label: Describe alternatives you've considered
|
| 21 |
+
description: A clear and concise description of any alternative solutions or features you've considered.
|
| 22 |
+
validations:
|
| 23 |
+
required: true
|
| 24 |
+
- type: textarea
|
| 25 |
+
attributes:
|
| 26 |
+
label: Additional context
|
| 27 |
+
description: Add any other context or screenshots about the feature request here.
|
| 28 |
+
validations:
|
| 29 |
+
required: false
|
github_code/freeCodeCamp__freeCodeCamp/.github/ISSUE_TEMPLATE/config.yml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
blank_issues_enabled: true
|
| 2 |
+
contact_links:
|
| 3 |
+
- name: Request programming help with coding challenges
|
| 4 |
+
url: https://forum.freecodecamp.org
|
| 5 |
+
about: Please visit this page for general support and programming help on coding challenges.
|
| 6 |
+
- name: Report issues with content on /news articles
|
| 7 |
+
url: https://mailxto.com/lkj5n7
|
| 8 |
+
about: Please fill out an email to our editorial team to report issues on specific articles on our technical publication (link opens an email template)
|
| 9 |
+
- name: Request technical support for your freeCodeCamp account
|
| 10 |
+
url: https://www.freecodecamp.org/support
|
| 11 |
+
about: Please visit this page for requesting technical support related to your freeCodeCamp account.
|
github_code/freeCodeCamp__freeCodeCamp/.github/PULL_REQUEST_TEMPLATE.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Checklist:
|
| 2 |
+
|
| 3 |
+
<!-- Please follow this checklist and put an x in each of the boxes, like this: [x]. It will ensure that our team takes your pull request seriously. -->
|
| 4 |
+
|
| 5 |
+
- [ ] I have read and followed the [contribution guidelines](https://contribute.freecodecamp.org).
|
| 6 |
+
- [ ] I have read and followed the [how to open a pull request guide](https://contribute.freecodecamp.org/how-to-open-a-pull-request/).
|
| 7 |
+
- [ ] My pull request targets the `main` branch of freeCodeCamp.
|
| 8 |
+
- [ ] I have tested these changes either locally on my machine, or GitHub Codespaces.
|
| 9 |
+
|
| 10 |
+
<!--If your pull request closes a GitHub issue, replace the XXXXX below with the issue number.-->
|
| 11 |
+
|
| 12 |
+
Closes #XXXXX
|
| 13 |
+
|
| 14 |
+
<!-- Feel free to add any additional description of changes below this line -->
|
github_code/freeCodeCamp__freeCodeCamp/.github/actions/setup-turbo-cache/action.yml
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Caching Behaviour:
|
| 2 |
+
# ┌─────────────────────────┬─────────────────┬──────────────────┐
|
| 3 |
+
# │ Context │ Can Read Cache? │ Can Write Cache? │
|
| 4 |
+
# ├─────────────────────────┼─────────────────┼──────────────────┤
|
| 5 |
+
# │ main (push) │ YES │ YES │
|
| 6 |
+
# ├─────────────────────────┼─────────────────┼──────────────────┤
|
| 7 |
+
# │ PRs / temp-* / hotfix-* │ YES │ NO │
|
| 8 |
+
# ├─────────────────────────┼─────────────────┼──────────────────┤
|
| 9 |
+
# │ prod-* │ NO │ NO │
|
| 10 |
+
# ├─────────────────────────┼─────────────────┼──────────────────┤
|
| 11 |
+
# │ Fork PRs │ NO │ NO │
|
| 12 |
+
# └─────────────────────────┴─────────────────┴──────────────────┘
|
| 13 |
+
|
| 14 |
+
name: 'Setup Turbo Remote Cache'
|
| 15 |
+
description: 'Conditionally configure Turbo remote cache based on branch and event context'
|
| 16 |
+
|
| 17 |
+
inputs:
|
| 18 |
+
turbo-token:
|
| 19 |
+
description: 'Turbo remote cache authentication token'
|
| 20 |
+
required: true
|
| 21 |
+
turbo-signature-key:
|
| 22 |
+
description: 'Turbo remote cache signature key for artifact signing/verification'
|
| 23 |
+
required: true
|
| 24 |
+
|
| 25 |
+
runs:
|
| 26 |
+
using: 'composite'
|
| 27 |
+
steps:
|
| 28 |
+
- name: Configure Turbo Remote Cache
|
| 29 |
+
shell: bash
|
| 30 |
+
env:
|
| 31 |
+
TURBO_TOKEN: ${{ inputs.turbo-token }}
|
| 32 |
+
TURBO_SIGNATURE_KEY: ${{ inputs.turbo-signature-key }}
|
| 33 |
+
GITHUB_REF_NAME: ${{ github.ref_name }}
|
| 34 |
+
GITHUB_EVENT_NAME: ${{ github.event_name }}
|
| 35 |
+
GITHUB_BASE_REF: ${{ github.base_ref }}
|
| 36 |
+
run: |
|
| 37 |
+
echo "::group::Turbo Cache Configuration"
|
| 38 |
+
echo "Branch: $GITHUB_REF_NAME"
|
| 39 |
+
echo "Event: $GITHUB_EVENT_NAME"
|
| 40 |
+
echo "Base ref: $GITHUB_BASE_REF"
|
| 41 |
+
|
| 42 |
+
# Skip for deployment branches (pure builds)
|
| 43 |
+
if [[ "$GITHUB_REF_NAME" == prod-* ]]; then
|
| 44 |
+
echo "::notice::Deployment branch detected - Turbo cache DISABLED for pure build"
|
| 45 |
+
echo "::endgroup::"
|
| 46 |
+
exit 0
|
| 47 |
+
fi
|
| 48 |
+
|
| 49 |
+
# Skip if secrets are not available (fork PRs)
|
| 50 |
+
if [[ -z "$TURBO_TOKEN" || -z "$TURBO_SIGNATURE_KEY" ]]; then
|
| 51 |
+
echo "::notice::Turbo secrets not available (likely a fork PR) - Turbo cache DISABLED"
|
| 52 |
+
echo "::endgroup::"
|
| 53 |
+
exit 0
|
| 54 |
+
fi
|
| 55 |
+
|
| 56 |
+
# Base configuration for all other contexts
|
| 57 |
+
echo "TURBO_API=https://turbo-cache.freecodecamp.net" >> $GITHUB_ENV
|
| 58 |
+
echo "TURBO_TEAM=team_freecodecamp" >> $GITHUB_ENV
|
| 59 |
+
echo "TURBO_TOKEN=$TURBO_TOKEN" >> $GITHUB_ENV
|
| 60 |
+
echo "TURBO_REMOTE_CACHE_SIGNATURE_KEY=$TURBO_SIGNATURE_KEY" >> $GITHUB_ENV
|
| 61 |
+
echo "TURBO_TELEMETRY_DISABLED=1" >> $GITHUB_ENV
|
| 62 |
+
|
| 63 |
+
# Determine if this context should have write access
|
| 64 |
+
# Write access: main branch push
|
| 65 |
+
# Read-only: PRs and other branches (can read from cache, can't pollute it)
|
| 66 |
+
if [[ "$GITHUB_REF_NAME" == "main" && "$GITHUB_EVENT_NAME" == "push" ]]; then
|
| 67 |
+
echo "::notice::Main branch push - Turbo cache READ/WRITE enabled"
|
| 68 |
+
else
|
| 69 |
+
# All other contexts: read-only
|
| 70 |
+
# Use TURBO_CACHE=remote:r for read-only remote cache (local still read/write)
|
| 71 |
+
echo "TURBO_CACHE=local:rw,remote:r" >> $GITHUB_ENV
|
| 72 |
+
echo "::notice::PR/other branch - Turbo cache READ-ONLY enabled"
|
| 73 |
+
fi
|
| 74 |
+
|
| 75 |
+
echo "::endgroup::"
|
github_code/freeCodeCamp__freeCodeCamp/.github/copilot-instructions.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GitHub Copilot Code Review Instructions
|
| 2 |
+
|
| 3 |
+
## Core Principles
|
| 4 |
+
|
| 5 |
+
**BE EXTREMELY MINIMAL.** Only provide actionable feedback.
|
| 6 |
+
|
| 7 |
+
**Skip all non-essential content:**
|
| 8 |
+
- Do not generate "Pull request overview" sections
|
| 9 |
+
- Do not create "Changes:" lists describing what was changed
|
| 10 |
+
- Do not create "Reviewed changes" sections or tables
|
| 11 |
+
- Do not list files with change descriptions
|
| 12 |
+
- Do not count how many files were reviewed
|
| 13 |
+
- Do not summarize what the PR does (visible in the diff)
|
| 14 |
+
|
| 15 |
+
**Focus only on problems:**
|
| 16 |
+
- Comment ONLY on actual issues that need fixing
|
| 17 |
+
- Keep each comment 1-3 sentences
|
| 18 |
+
- If everything is correct, provide no output
|
| 19 |
+
|
| 20 |
+
**Bad example (from PR 65578):**
|
| 21 |
+
```
|
| 22 |
+
## Pull request overview
|
| 23 |
+
This PR addresses issue 65331 by replacing em dash characters...
|
| 24 |
+
|
| 25 |
+
### Reviewed changes
|
| 26 |
+
Copilot reviewed 4 out of 4 changed files...
|
| 27 |
+
|
| 28 |
+
| File | Description |
|
| 29 |
+
| ---- | ----------- |
|
| 30 |
+
| file1.md | Updated em dash in seed content |
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
**Good example (actionable feedback only):**
|
| 34 |
+
```
|
| 35 |
+
Line 46: Test will fail - `innerText` returns rendered `—`, not `—`.
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
## Focus Areas
|
| 41 |
+
|
| 42 |
+
1. **Test Coverage** - Ensuring adequate testing for code changes
|
| 43 |
+
2. **Pull Request Guidelines** - Compliance with contribution standards
|
| 44 |
+
|
| 45 |
+
---
|
| 46 |
+
|
| 47 |
+
## Focus Area 1: Test Coverage
|
| 48 |
+
|
| 49 |
+
When reviewing pull requests, ensure adequate test coverage for code changes in JavaScript, TypeScript, JSX, and TSX files.
|
| 50 |
+
|
| 51 |
+
> Detailed test coverage rules are in `.github/instructions/testing.instructions.md`
|
| 52 |
+
|
| 53 |
+
### Quick Reference
|
| 54 |
+
|
| 55 |
+
| Location | Framework | File Pattern |
|
| 56 |
+
|----------|-----------|--------------|
|
| 57 |
+
| `api/` | Vitest | `*.test.ts` |
|
| 58 |
+
| `client/` | Vitest | `*.test.{ts,tsx}` |
|
| 59 |
+
| `e2e/` | Playwright | `*.spec.ts` |
|
| 60 |
+
|
| 61 |
+
### When to Comment
|
| 62 |
+
|
| 63 |
+
Only leave a comment if:
|
| 64 |
+
|
| 65 |
+
- The PR modifies JavaScript/TypeScript/JSX/TSX code (bug fixes or new features)
|
| 66 |
+
- AND there are no corresponding test additions or updates
|
| 67 |
+
|
| 68 |
+
### When NOT to Comment
|
| 69 |
+
|
| 70 |
+
Do not comment if:
|
| 71 |
+
|
| 72 |
+
- Changes are only to documentation, configuration, or non-JS/TS files
|
| 73 |
+
- The PR includes appropriate test coverage for the changes
|
| 74 |
+
- Changes are test-only modifications
|
| 75 |
+
|
| 76 |
+
### Comment Style
|
| 77 |
+
|
| 78 |
+
If tests are missing, provide ONE brief comment:
|
| 79 |
+
|
| 80 |
+
```
|
| 81 |
+
Missing tests for [specific file]. Consider:
|
| 82 |
+
- [specific scenario]
|
| 83 |
+
- [edge case]
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
If test coverage is sufficient, **DO NOT COMMENT**. No "LGTM" needed.
|
| 87 |
+
|
| 88 |
+
---
|
| 89 |
+
|
| 90 |
+
## Focus Area 2: Pull Request Guidelines
|
| 91 |
+
|
| 92 |
+
When reviewing pull requests, verify compliance with [freeCodeCamp's contribution standards](https://contribute.freecodecamp.org/how-to-open-a-pull-request).
|
| 93 |
+
|
| 94 |
+
### PR Title Format
|
| 95 |
+
|
| 96 |
+
Check that the title follows conventional commits format:
|
| 97 |
+
`<type>([optional scope]): <description>`
|
| 98 |
+
|
| 99 |
+
**Valid types:** `fix`, `feat`, `refactor`, `docs`, `test`
|
| 100 |
+
|
| 101 |
+
**Common scopes:** `curriculum`, `client`, `api`, `i18n`, `a11y`, `tools`
|
| 102 |
+
|
| 103 |
+
Flag if:
|
| 104 |
+
|
| 105 |
+
- Title is vague (e.g., "Update file", "Fix bug", "Changes")
|
| 106 |
+
- Missing type prefix
|
| 107 |
+
- Description exceeds ~50 characters
|
| 108 |
+
- Type doesn't match the actual changes
|
| 109 |
+
|
| 110 |
+
Example of good title:
|
| 111 |
+
|
| 112 |
+
```
|
| 113 |
+
fix(client): resolve login button alignment on mobile
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
Example of bad title:
|
| 117 |
+
|
| 118 |
+
```
|
| 119 |
+
Fixed stuff
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
### PR Description & Issue Linking
|
| 123 |
+
|
| 124 |
+
Check for:
|
| 125 |
+
|
| 126 |
+
- Meaningful description explaining what changes were made and why
|
| 127 |
+
- Proper issue linking using `Closes #XXXXX` format (not just `#XXXXX`)
|
| 128 |
+
- Screenshots included for UI/visual changes
|
| 129 |
+
|
| 130 |
+
Flag if:
|
| 131 |
+
|
| 132 |
+
- Description is empty or only contains template boilerplate
|
| 133 |
+
- Issue reference uses incorrect format (e.g., `fixes XXXXX` without `#`)
|
| 134 |
+
- UI changes lack screenshots
|
| 135 |
+
|
| 136 |
+
### Checklist Completion
|
| 137 |
+
|
| 138 |
+
Verify the PR template checklist items are completed:
|
| 139 |
+
|
| 140 |
+
- Boxes should be checked (`[x]`) not left unchecked (`[ ]`)
|
| 141 |
+
- Placeholder text like `#XXXXX` should be replaced with actual issue numbers
|
| 142 |
+
|
| 143 |
+
Flag if:
|
| 144 |
+
|
| 145 |
+
- Checklist boxes are left unchecked
|
| 146 |
+
- Placeholder issue number `#XXXXX` remains unchanged
|
| 147 |
+
|
| 148 |
+
### Comment Style
|
| 149 |
+
|
| 150 |
+
Keep feedback minimal (one line when possible):
|
| 151 |
+
|
| 152 |
+
```
|
| 153 |
+
Update PR title to format: `<type>(scope): description`
|
| 154 |
+
See: https://contribute.freecodecamp.org/how-to-open-a-pull-request
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
```
|
| 158 |
+
Link issue using: `Closes #XXXXX`
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
+
If PR guidelines are followed, **DO NOT COMMENT**. No "LGTM" needed.
|
| 162 |
+
|
| 163 |
+
---
|
| 164 |
+
|
| 165 |
+
## General Guidelines
|
| 166 |
+
|
| 167 |
+
**Focus on Actionable Issues Only**
|
| 168 |
+
|
| 169 |
+
### Strict Rules
|
| 170 |
+
|
| 171 |
+
- NO summaries, overviews, or descriptions of changes
|
| 172 |
+
- NO tables or file listings
|
| 173 |
+
- NO "LGTM" or affirmative comments when everything is fine
|
| 174 |
+
- Only comment when action is required
|
| 175 |
+
- Keep each comment brief and actionable
|
| 176 |
+
|
| 177 |
+
### Prioritization
|
| 178 |
+
|
| 179 |
+
When multiple issues exist, address them in order of severity:
|
| 180 |
+
|
| 181 |
+
1. Security vulnerabilities or critical bugs
|
| 182 |
+
2. Missing test coverage for new functionality
|
| 183 |
+
3. Outdated tests for modified functionality
|
| 184 |
+
4. PR title/description compliance
|
| 185 |
+
|
| 186 |
+
Comment on all legitimate issues, but keep each comment concise.
|
github_code/freeCodeCamp__freeCodeCamp/.github/instructions/testing.instructions.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
applyTo: "**/*.{ts,tsx,js,jsx}"
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Test Coverage Review Instructions
|
| 6 |
+
|
| 7 |
+
Review code changes for adequate test coverage using freeCodeCamp's testing conventions.
|
| 8 |
+
|
| 9 |
+
## Testing Framework Reference
|
| 10 |
+
|
| 11 |
+
| Location | Framework | File Pattern | Notes |
|
| 12 |
+
|----------|-----------|--------------|-------|
|
| 13 |
+
| `api/` | Vitest | `*.test.ts` | Co-located with source |
|
| 14 |
+
| `client/` | Vitest | `*.test.{ts,tsx}` | Co-located with source |
|
| 15 |
+
| `e2e/` | Playwright | `*.spec.ts` | Dedicated directory |
|
| 16 |
+
|
| 17 |
+
## When to Flag Missing Tests
|
| 18 |
+
|
| 19 |
+
Comment on missing tests if ALL of these are true:
|
| 20 |
+
|
| 21 |
+
- PR modifies functional code (bug fix or new feature)
|
| 22 |
+
- No corresponding test additions or modifications exist
|
| 23 |
+
- Changes are not test-only or config-only
|
| 24 |
+
|
| 25 |
+
### Examples Requiring Tests
|
| 26 |
+
|
| 27 |
+
- New utility functions in `api/src/utils/` or `client/src/utils/`
|
| 28 |
+
- New API route handlers in `api/src/routes/`
|
| 29 |
+
- New React components with logic in `client/src/components/`
|
| 30 |
+
- Bug fixes that change application behavior
|
| 31 |
+
- New validation logic or data transformations
|
| 32 |
+
|
| 33 |
+
## When NOT to Flag
|
| 34 |
+
|
| 35 |
+
Do not comment on test coverage if:
|
| 36 |
+
|
| 37 |
+
- Changes are documentation, configuration, or non-functional
|
| 38 |
+
- PR already includes appropriate test coverage
|
| 39 |
+
- Changes are to test files themselves
|
| 40 |
+
- Changes are trivial:
|
| 41 |
+
- Import reorganization
|
| 42 |
+
- Formatting changes
|
| 43 |
+
- Type-only changes (interfaces, type definitions)
|
| 44 |
+
- Comment updates
|
| 45 |
+
- Changes are in areas without existing test patterns:
|
| 46 |
+
- Curriculum markdown files
|
| 47 |
+
- Configuration files
|
| 48 |
+
- Build scripts
|
| 49 |
+
|
| 50 |
+
## Detecting Outdated Tests
|
| 51 |
+
|
| 52 |
+
Flag if existing tests may be outdated:
|
| 53 |
+
|
| 54 |
+
- Test file exists for modified source but doesn't cover the changed functionality
|
| 55 |
+
- Test assertions reference behavior that is being changed
|
| 56 |
+
- Mock data doesn't reflect new data structures or API responses
|
| 57 |
+
- Test descriptions no longer match actual test behavior
|
| 58 |
+
|
| 59 |
+
### Example Comment for Outdated Tests
|
| 60 |
+
|
| 61 |
+
```
|
| 62 |
+
Tests in `src/utils/validate.test.ts` need updates for new validation rules.
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
## Comment Format
|
| 66 |
+
|
| 67 |
+
### Missing Tests
|
| 68 |
+
|
| 69 |
+
Brief, actionable feedback only:
|
| 70 |
+
|
| 71 |
+
```
|
| 72 |
+
Missing tests for `src/utils/validate.ts`:
|
| 73 |
+
- Valid input case
|
| 74 |
+
- Invalid input error
|
| 75 |
+
- Empty string edge case
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
### Sufficient Coverage
|
| 79 |
+
|
| 80 |
+
**DO NOT COMMENT.** Silence means approval.
|
| 81 |
+
|
| 82 |
+
### Outdated Tests
|
| 83 |
+
|
| 84 |
+
```
|
| 85 |
+
Tests in `[test file]` need updates for `[source file]` changes:
|
| 86 |
+
- [specific change]
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
## Test Quality Indicators
|
| 90 |
+
|
| 91 |
+
When tests are present, briefly verify:
|
| 92 |
+
|
| 93 |
+
- Tests cover the happy path
|
| 94 |
+
- Tests cover at least one error/edge case
|
| 95 |
+
- Test descriptions are meaningful (not just "test 1", "test 2")
|
| 96 |
+
- Mocks are appropriate (not mocking the thing being tested)
|
| 97 |
+
|
| 98 |
+
Do not block PRs for test style preferences if coverage is adequate.
|
github_code/freeCodeCamp__freeCodeCamp/.github/labeler.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'scope: curriculum':
|
| 2 |
+
- changed-files:
|
| 3 |
+
- any-glob-to-any-file: curriculum/challenges/**/*
|
| 4 |
+
|
| 5 |
+
'platform: learn':
|
| 6 |
+
- changed-files:
|
| 7 |
+
- any-glob-to-any-file: client/**/*
|
| 8 |
+
|
| 9 |
+
'platform: api':
|
| 10 |
+
- changed-files:
|
| 11 |
+
- any-glob-to-any-file: api/**/*
|
| 12 |
+
|
| 13 |
+
'scope: tools/scripts':
|
| 14 |
+
- changed-files:
|
| 15 |
+
- any-glob-to-any-file:
|
| 16 |
+
- tools/**/*
|
| 17 |
+
- .github/**/*
|
| 18 |
+
- utils/**/*
|
| 19 |
+
- e2e/**/*
|
| 20 |
+
|
| 21 |
+
'scope: i18n':
|
| 22 |
+
- changed-files:
|
| 23 |
+
- any-glob-to-any-file:
|
| 24 |
+
- client/i18n/**/*
|
| 25 |
+
- config/crowdin/**/*
|
| 26 |
+
- shared/config/i18n/**/*
|
github_code/freeCodeCamp__freeCodeCamp/.github/scripts/pr-guidelines/check-allow-list.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
module.exports = async ({ github, context, core }) => {
|
| 4 |
+
const prAuthor = context.payload.pull_request.user.login;
|
| 5 |
+
|
| 6 |
+
const teamSlugs = ['dev-team', 'curriculum', 'staff', 'moderators'];
|
| 7 |
+
const membershipChecks = teamSlugs.map(team_slug =>
|
| 8 |
+
github.rest.teams
|
| 9 |
+
.getMembershipForUserInOrg({
|
| 10 |
+
org: 'freeCodeCamp',
|
| 11 |
+
team_slug,
|
| 12 |
+
username: prAuthor
|
| 13 |
+
})
|
| 14 |
+
.then(({ data }) => data.state === 'active')
|
| 15 |
+
.catch(() => false)
|
| 16 |
+
);
|
| 17 |
+
const results = await Promise.all(membershipChecks);
|
| 18 |
+
const isOrgTeamMember = results.some(Boolean);
|
| 19 |
+
|
| 20 |
+
const isAllowListed =
|
| 21 |
+
isOrgTeamMember || ['camperbot', 'renovate[bot]'].includes(prAuthor);
|
| 22 |
+
|
| 23 |
+
core.setOutput('is_allow_listed', isAllowListed);
|
| 24 |
+
};
|
github_code/freeCodeCamp__freeCodeCamp/.github/scripts/pr-guidelines/check-pr-template.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
module.exports = async ({ github, context, core, isAllowListed }) => {
|
| 4 |
+
if (isAllowListed === 'true') return;
|
| 5 |
+
|
| 6 |
+
const body = (context.payload.pull_request.body || '').toLowerCase();
|
| 7 |
+
|
| 8 |
+
// The template must be present and the first 3 checkboxes must be
|
| 9 |
+
// ticked. The last checkbox (tested locally) is acceptable to leave
|
| 10 |
+
// unticked.
|
| 11 |
+
const templatePresent = body.includes('checklist:');
|
| 12 |
+
const requiredTicked = [
|
| 13 |
+
'i have read and followed the contribution guidelines',
|
| 14 |
+
'i have read and followed the how to open a pull request guide',
|
| 15 |
+
'my pull request targets the'
|
| 16 |
+
];
|
| 17 |
+
// Strip markdown links ([text](url) → text) before matching so contributors
|
| 18 |
+
// who omit the link syntax (e.g. type plain text) still pass the check.
|
| 19 |
+
const normalizedBody = body
|
| 20 |
+
.replace(/\[\s*x\s*\]/g, '[x]')
|
| 21 |
+
.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1');
|
| 22 |
+
const allRequiredTicked = requiredTicked.every(item =>
|
| 23 |
+
normalizedBody.includes(`[x] ${item}`)
|
| 24 |
+
);
|
| 25 |
+
|
| 26 |
+
if (templatePresent && allRequiredTicked) return;
|
| 27 |
+
|
| 28 |
+
core.setOutput('failure_reason', 'incomplete_checklist');
|
| 29 |
+
core.setFailed(
|
| 30 |
+
'PR description is missing the required checklist or some items are incomplete.'
|
| 31 |
+
);
|
| 32 |
+
|
| 33 |
+
await github.rest.issues.addLabels({
|
| 34 |
+
owner: context.repo.owner,
|
| 35 |
+
repo: context.repo.repo,
|
| 36 |
+
issue_number: context.payload.pull_request.number,
|
| 37 |
+
labels: ['deprioritized']
|
| 38 |
+
});
|
| 39 |
+
};
|
github_code/freeCodeCamp__freeCodeCamp/.github/scripts/pr-guidelines/fix-pr-title.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
// Returns the minimum number of single-character edits (insert, delete, substitute)
|
| 4 |
+
// needed to turn string `a` into string `b`.
|
| 5 |
+
function levenshtein(a, b) {
|
| 6 |
+
const dp = Array.from({ length: a.length + 1 }, (_, i) =>
|
| 7 |
+
Array.from({ length: b.length + 1 }, (_, j) =>
|
| 8 |
+
i === 0 ? j : j === 0 ? i : 0
|
| 9 |
+
)
|
| 10 |
+
);
|
| 11 |
+
for (let i = 1; i <= a.length; i++) {
|
| 12 |
+
for (let j = 1; j <= b.length; j++) {
|
| 13 |
+
dp[i][j] =
|
| 14 |
+
a[i - 1] === b[j - 1]
|
| 15 |
+
? dp[i - 1][j - 1]
|
| 16 |
+
: 1 + Math.min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]);
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
return dp[a.length][b.length];
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
module.exports = async ({ github, context }) => {
|
| 23 |
+
const title = context.payload.pull_request.title;
|
| 24 |
+
const ccRegex =
|
| 25 |
+
/^(feat|fix|refactor|docs|chore|build|ci|test|perf|revert)(\([^)]+\))?: .+/;
|
| 26 |
+
|
| 27 |
+
if (ccRegex.test(title)) return;
|
| 28 |
+
|
| 29 |
+
const types = [
|
| 30 |
+
'feat',
|
| 31 |
+
'fix',
|
| 32 |
+
'refactor',
|
| 33 |
+
'docs',
|
| 34 |
+
'chore',
|
| 35 |
+
'build',
|
| 36 |
+
'ci',
|
| 37 |
+
'test',
|
| 38 |
+
'perf',
|
| 39 |
+
'revert'
|
| 40 |
+
];
|
| 41 |
+
|
| 42 |
+
let newTitle = title;
|
| 43 |
+
|
| 44 |
+
// Fix 1: space between type and scope — "feat (scope):" → "feat(scope):"
|
| 45 |
+
newTitle = newTitle.replace(/^(\w+)\s+(\([^)]+\):)/, '$1$2');
|
| 46 |
+
|
| 47 |
+
// Fix 2: missing colon after scope — "feat(scope) desc" → "feat(scope): desc"
|
| 48 |
+
newTitle = newTitle.replace(/^(\w+\([^)]+\)) ([^:])/, '$1: $2');
|
| 49 |
+
|
| 50 |
+
// Fix 3: typo in type — "refator(scope):" → "refactor(scope):" (distance ≤ 2)
|
| 51 |
+
const typoMatch = newTitle.match(/^(\w+)(\([^)]+\))?:/);
|
| 52 |
+
if (typoMatch) {
|
| 53 |
+
const candidate = typoMatch[1];
|
| 54 |
+
if (!types.includes(candidate)) {
|
| 55 |
+
const closest = types
|
| 56 |
+
.map(t => ({ t, d: levenshtein(candidate, t) }))
|
| 57 |
+
.filter(x => x.d <= 2)
|
| 58 |
+
.sort((a, b) => a.d - b.d)[0];
|
| 59 |
+
if (closest) newTitle = newTitle.replace(candidate, closest.t);
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
// Fix 4: missing space after colon — "fix:desc" → "fix: desc"
|
| 64 |
+
newTitle = newTitle.replace(/^(\w+(?:\([^)]+\))?):(\S)/, '$1: $2');
|
| 65 |
+
|
| 66 |
+
// Catch-all: prefix with "fix: " if still not a valid CC title
|
| 67 |
+
if (!ccRegex.test(newTitle)) {
|
| 68 |
+
newTitle = `fix: ${newTitle}`;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
if (newTitle !== title) {
|
| 72 |
+
await github.rest.pulls.update({
|
| 73 |
+
owner: context.repo.owner,
|
| 74 |
+
repo: context.repo.repo,
|
| 75 |
+
pull_number: context.payload.pull_request.number,
|
| 76 |
+
title: newTitle
|
| 77 |
+
});
|
| 78 |
+
}
|
| 79 |
+
};
|
github_code/freeCodeCamp__freeCodeCamp/.github/scripts/pr-guidelines/report-results.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
const FOOTER =
|
| 4 |
+
'\n\n---\nJoin us in our [chat room](https://discord.gg/PRyKn3Vbay) or our [forum](https://forum.freecodecamp.org/c/contributors/3) if you have any questions or need help with contributing.';
|
| 5 |
+
|
| 6 |
+
const TEMPLATE_BLOCK = [
|
| 7 |
+
'```md',
|
| 8 |
+
'Checklist:',
|
| 9 |
+
'',
|
| 10 |
+
'<!-- Please follow this checklist and put an x in each of the boxes, like this: [x]. It will ensure that our team takes your pull request seriously. -->',
|
| 11 |
+
'',
|
| 12 |
+
'- [ ] I have read and followed the [contribution guidelines](https://contribute.freecodecamp.org).',
|
| 13 |
+
'- [ ] I have read and followed the [how to open a pull request guide](https://contribute.freecodecamp.org/how-to-open-a-pull-request/).',
|
| 14 |
+
"- [ ] My pull request targets the `main` branch of freeCodeCamp.",
|
| 15 |
+
'- [ ] I have tested these changes either locally on my machine, or GitHub Codespaces.',
|
| 16 |
+
'',
|
| 17 |
+
'<!--If your pull request closes a GitHub issue, replace the XXXXX below with the issue number.-->',
|
| 18 |
+
'',
|
| 19 |
+
'Closes #XXXXX',
|
| 20 |
+
'',
|
| 21 |
+
'<!-- Feel free to add any additional description of changes below this line -->',
|
| 22 |
+
'```'
|
| 23 |
+
].join('\n');
|
| 24 |
+
|
| 25 |
+
const MESSAGES = {
|
| 26 |
+
incomplete_checklist: [
|
| 27 |
+
'**Checklist:** The PR description is missing the required checklist or some of its items are not completed:',
|
| 28 |
+
'',
|
| 29 |
+
'1. The `Checklist:` heading is present in the PR description.',
|
| 30 |
+
'2. The checkbox items are ticked (changed from `[ ]` to `[x]`).',
|
| 31 |
+
'3. You have actually completed the items in the checklist.',
|
| 32 |
+
'',
|
| 33 |
+
'Please edit your PR description to include the following template with the checklist items completed.',
|
| 34 |
+
'',
|
| 35 |
+
TEMPLATE_BLOCK
|
| 36 |
+
].join('\n')
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
module.exports = async ({ github, context, templateResult, templateReason }) => {
|
| 40 |
+
const allPassed = templateResult === 'success';
|
| 41 |
+
|
| 42 |
+
if (allPassed) {
|
| 43 |
+
try {
|
| 44 |
+
await github.rest.issues.removeLabel({
|
| 45 |
+
owner: context.repo.owner,
|
| 46 |
+
repo: context.repo.repo,
|
| 47 |
+
issue_number: context.issue.number,
|
| 48 |
+
name: 'deprioritized'
|
| 49 |
+
});
|
| 50 |
+
} catch {
|
| 51 |
+
// Label may not exist — ignore.
|
| 52 |
+
}
|
| 53 |
+
return;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
// On edit, don't re-comment — the original comment is already there.
|
| 57 |
+
if (context.payload.action === 'edited') return;
|
| 58 |
+
|
| 59 |
+
const sections = [];
|
| 60 |
+
if (templateResult === 'failure' && MESSAGES[templateReason]) {
|
| 61 |
+
sections.push(MESSAGES[templateReason]);
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
if (sections.length === 0) return;
|
| 65 |
+
|
| 66 |
+
const body =
|
| 67 |
+
[
|
| 68 |
+
'Hi there,',
|
| 69 |
+
'',
|
| 70 |
+
'Thanks for opening this pull request.',
|
| 71 |
+
'',
|
| 72 |
+
'The automated checks found some issues:',
|
| 73 |
+
'',
|
| 74 |
+
sections.join('\n\n')
|
| 75 |
+
].join('\n') + FOOTER;
|
| 76 |
+
|
| 77 |
+
await github.rest.issues.createComment({
|
| 78 |
+
owner: context.repo.owner,
|
| 79 |
+
repo: context.repo.repo,
|
| 80 |
+
issue_number: context.issue.number,
|
| 81 |
+
body
|
| 82 |
+
});
|
| 83 |
+
};
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/crowdin-download.client-ui.yml
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: i18n - Download Client UI
|
| 2 |
+
on:
|
| 3 |
+
workflow_dispatch:
|
| 4 |
+
schedule:
|
| 5 |
+
# runs Monday and Wednesday at 12:15 PM UTC
|
| 6 |
+
- cron: '15 12 * * 1,3'
|
| 7 |
+
|
| 8 |
+
env:
|
| 9 |
+
GITHUB_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_PAT }}
|
| 10 |
+
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }}
|
| 11 |
+
CROWDIN_API_URL: 'https://freecodecamp.crowdin.com/api/v2/'
|
| 12 |
+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_CLIENT }}
|
| 13 |
+
|
| 14 |
+
permissions:
|
| 15 |
+
contents: read
|
| 16 |
+
|
| 17 |
+
jobs:
|
| 18 |
+
i18n-download-client-ui-translations:
|
| 19 |
+
name: Client
|
| 20 |
+
runs-on: ubuntu-24.04
|
| 21 |
+
|
| 22 |
+
steps:
|
| 23 |
+
- name: Checkout Source Files
|
| 24 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
| 25 |
+
with:
|
| 26 |
+
token: ${{ secrets.CROWDIN_CAMPERBOT_PAT }}
|
| 27 |
+
|
| 28 |
+
- name: Generate Crowdin Config
|
| 29 |
+
uses: freecodecamp/crowdin-action@36a78cbf92f5a6c05a3a32dc8bf434a19a7c59e2 # main
|
| 30 |
+
env:
|
| 31 |
+
PLUGIN: 'generate-config'
|
| 32 |
+
PROJECT_NAME: 'client'
|
| 33 |
+
|
| 34 |
+
##### Download Chinese #####
|
| 35 |
+
- name: Crowdin Download Chinese Translations
|
| 36 |
+
uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2.17.0
|
| 37 |
+
# options: https://github.com/crowdin/github-action/blob/master/action.yml
|
| 38 |
+
with:
|
| 39 |
+
# uploads
|
| 40 |
+
upload_sources: false
|
| 41 |
+
upload_translations: false
|
| 42 |
+
auto_approve_imported: false
|
| 43 |
+
import_eq_suggestions: false
|
| 44 |
+
|
| 45 |
+
# downloads
|
| 46 |
+
download_translations: true
|
| 47 |
+
download_language: zh-CN
|
| 48 |
+
skip_untranslated_files: false
|
| 49 |
+
export_only_approved: true
|
| 50 |
+
|
| 51 |
+
push_translations: false
|
| 52 |
+
|
| 53 |
+
# pull-request
|
| 54 |
+
create_pull_request: false
|
| 55 |
+
|
| 56 |
+
# global options
|
| 57 |
+
config: './crowdin-config.yml'
|
| 58 |
+
base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }}
|
| 59 |
+
|
| 60 |
+
# Uncomment below to debug
|
| 61 |
+
# dryrun_action: true
|
| 62 |
+
|
| 63 |
+
# Convert Simplified Chinese to Traditional #
|
| 64 |
+
- name: Convert Chinese
|
| 65 |
+
uses: freecodecamp/crowdin-action@36a78cbf92f5a6c05a3a32dc8bf434a19a7c59e2 # main
|
| 66 |
+
env:
|
| 67 |
+
PLUGIN: 'convert-chinese'
|
| 68 |
+
FILE_PATHS: '["client/i18n/locales/chinese"]'
|
| 69 |
+
|
| 70 |
+
##### Download Espanol #####
|
| 71 |
+
- name: Crowdin Download Espanol Translations
|
| 72 |
+
uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2.17.0
|
| 73 |
+
# options: https://github.com/crowdin/github-action/blob/master/action.yml
|
| 74 |
+
with:
|
| 75 |
+
# uploads
|
| 76 |
+
upload_sources: false
|
| 77 |
+
upload_translations: false
|
| 78 |
+
auto_approve_imported: false
|
| 79 |
+
import_eq_suggestions: false
|
| 80 |
+
|
| 81 |
+
# downloads
|
| 82 |
+
download_translations: true
|
| 83 |
+
download_language: es-EM
|
| 84 |
+
skip_untranslated_files: false
|
| 85 |
+
export_only_approved: true
|
| 86 |
+
|
| 87 |
+
push_translations: false
|
| 88 |
+
|
| 89 |
+
# pull-request
|
| 90 |
+
create_pull_request: false
|
| 91 |
+
|
| 92 |
+
# global options
|
| 93 |
+
config: './crowdin-config.yml'
|
| 94 |
+
base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }}
|
| 95 |
+
|
| 96 |
+
# Uncomment below to debug
|
| 97 |
+
# dryrun_action: true
|
| 98 |
+
|
| 99 |
+
##### Download Italian #####
|
| 100 |
+
- name: Crowdin Download Italian Translations
|
| 101 |
+
uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2.17.0
|
| 102 |
+
# options: https://github.com/crowdin/github-action/blob/master/action.yml
|
| 103 |
+
with:
|
| 104 |
+
# uploads
|
| 105 |
+
upload_sources: false
|
| 106 |
+
upload_translations: false
|
| 107 |
+
auto_approve_imported: false
|
| 108 |
+
import_eq_suggestions: false
|
| 109 |
+
|
| 110 |
+
# downloads
|
| 111 |
+
download_translations: true
|
| 112 |
+
download_language: it
|
| 113 |
+
skip_untranslated_files: false
|
| 114 |
+
export_only_approved: true
|
| 115 |
+
|
| 116 |
+
push_translations: false
|
| 117 |
+
|
| 118 |
+
# pull-request
|
| 119 |
+
create_pull_request: false
|
| 120 |
+
|
| 121 |
+
# global options
|
| 122 |
+
config: './crowdin-config.yml'
|
| 123 |
+
base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }}
|
| 124 |
+
|
| 125 |
+
# Uncomment below to debug
|
| 126 |
+
# dryrun_action: true
|
| 127 |
+
|
| 128 |
+
##### Download Brazilian Portuguese #####
|
| 129 |
+
- name: Crowdin Download Portuguese (Brazilian) Translations
|
| 130 |
+
uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2.17.0
|
| 131 |
+
# options: https://github.com/crowdin/github-action/blob/master/action.yml
|
| 132 |
+
with:
|
| 133 |
+
# uploads
|
| 134 |
+
upload_sources: false
|
| 135 |
+
upload_translations: false
|
| 136 |
+
auto_approve_imported: false
|
| 137 |
+
import_eq_suggestions: false
|
| 138 |
+
|
| 139 |
+
# downloads
|
| 140 |
+
download_translations: true
|
| 141 |
+
download_language: pt-BR
|
| 142 |
+
skip_untranslated_files: false
|
| 143 |
+
export_only_approved: true
|
| 144 |
+
|
| 145 |
+
push_translations: false
|
| 146 |
+
|
| 147 |
+
# pull-request
|
| 148 |
+
create_pull_request: false
|
| 149 |
+
|
| 150 |
+
# global options
|
| 151 |
+
config: './crowdin-config.yml'
|
| 152 |
+
base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }}
|
| 153 |
+
|
| 154 |
+
# Uncomment below to debug
|
| 155 |
+
# dryrun_action: true
|
| 156 |
+
|
| 157 |
+
##### Download Ukrainian #####
|
| 158 |
+
- name: Crowdin Download Ukrainian Translations
|
| 159 |
+
uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2.17.0
|
| 160 |
+
# options: https://github.com/crowdin/github-action/blob/master/action.yml
|
| 161 |
+
with:
|
| 162 |
+
# uploads
|
| 163 |
+
upload_sources: false
|
| 164 |
+
upload_translations: false
|
| 165 |
+
auto_approve_imported: false
|
| 166 |
+
import_eq_suggestions: false
|
| 167 |
+
|
| 168 |
+
# downloads
|
| 169 |
+
download_translations: true
|
| 170 |
+
download_language: uk
|
| 171 |
+
skip_untranslated_files: false
|
| 172 |
+
export_only_approved: true
|
| 173 |
+
|
| 174 |
+
push_translations: false
|
| 175 |
+
|
| 176 |
+
# pull-request
|
| 177 |
+
create_pull_request: false
|
| 178 |
+
|
| 179 |
+
# global options
|
| 180 |
+
config: './crowdin-config.yml'
|
| 181 |
+
base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }}
|
| 182 |
+
|
| 183 |
+
# Uncomment below to debug
|
| 184 |
+
# dryrun_action: true
|
| 185 |
+
|
| 186 |
+
##### Download Japanese #####
|
| 187 |
+
- name: Crowdin Download Japanese Translations
|
| 188 |
+
uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2.17.0
|
| 189 |
+
# options: https://github.com/crowdin/github-action/blob/master/action.yml
|
| 190 |
+
with:
|
| 191 |
+
# uploads
|
| 192 |
+
upload_sources: false
|
| 193 |
+
upload_translations: false
|
| 194 |
+
auto_approve_imported: false
|
| 195 |
+
import_eq_suggestions: false
|
| 196 |
+
|
| 197 |
+
# downloads
|
| 198 |
+
download_translations: true
|
| 199 |
+
download_language: ja
|
| 200 |
+
skip_untranslated_files: false
|
| 201 |
+
export_only_approved: true
|
| 202 |
+
|
| 203 |
+
push_translations: false
|
| 204 |
+
|
| 205 |
+
# pull-request
|
| 206 |
+
create_pull_request: false
|
| 207 |
+
|
| 208 |
+
# global options
|
| 209 |
+
config: './crowdin-config.yml'
|
| 210 |
+
base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }}
|
| 211 |
+
|
| 212 |
+
# Uncomment below to debug
|
| 213 |
+
# dryrun_action: true
|
| 214 |
+
|
| 215 |
+
##### Download German #####
|
| 216 |
+
- name: Crowdin Download German Translations
|
| 217 |
+
uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2.17.0
|
| 218 |
+
# options: https://github.com/crowdin/github-action/blob/master/action.yml
|
| 219 |
+
with:
|
| 220 |
+
# uploads
|
| 221 |
+
upload_sources: false
|
| 222 |
+
upload_translations: false
|
| 223 |
+
auto_approve_imported: false
|
| 224 |
+
import_eq_suggestions: false
|
| 225 |
+
|
| 226 |
+
# downloads
|
| 227 |
+
download_translations: true
|
| 228 |
+
download_language: de
|
| 229 |
+
skip_untranslated_files: false
|
| 230 |
+
export_only_approved: true
|
| 231 |
+
|
| 232 |
+
push_translations: false
|
| 233 |
+
|
| 234 |
+
# pull-request
|
| 235 |
+
create_pull_request: false
|
| 236 |
+
|
| 237 |
+
# global options
|
| 238 |
+
config: './crowdin-config.yml'
|
| 239 |
+
base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }}
|
| 240 |
+
|
| 241 |
+
# Uncomment below to debug
|
| 242 |
+
# dryrun_action: true
|
| 243 |
+
|
| 244 |
+
##### Download Swahili #####
|
| 245 |
+
- name: Crowdin Download Swahili Translations
|
| 246 |
+
uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2.17.0
|
| 247 |
+
# options: https://github.com/crowdin/github-action/blob/master/action.yml
|
| 248 |
+
with:
|
| 249 |
+
# uploads
|
| 250 |
+
upload_sources: false
|
| 251 |
+
upload_translations: false
|
| 252 |
+
auto_approve_imported: false
|
| 253 |
+
import_eq_suggestions: false
|
| 254 |
+
|
| 255 |
+
# downloads
|
| 256 |
+
download_translations: true
|
| 257 |
+
download_language: sw
|
| 258 |
+
skip_untranslated_files: false
|
| 259 |
+
export_only_approved: true
|
| 260 |
+
|
| 261 |
+
push_translations: false
|
| 262 |
+
|
| 263 |
+
# pull-request
|
| 264 |
+
create_pull_request: false
|
| 265 |
+
|
| 266 |
+
# global options
|
| 267 |
+
config: './crowdin-config.yml'
|
| 268 |
+
base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }}
|
| 269 |
+
|
| 270 |
+
# Uncomment below to debug
|
| 271 |
+
# dryrun_action: true
|
| 272 |
+
|
| 273 |
+
##### Download Korean #####
|
| 274 |
+
- name: Crowdin Download Korean Translations
|
| 275 |
+
uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2.17.0
|
| 276 |
+
# options: https://github.com/crowdin/github-action/blob/master/action.yml
|
| 277 |
+
with:
|
| 278 |
+
# uploads
|
| 279 |
+
upload_sources: false
|
| 280 |
+
upload_translations: false
|
| 281 |
+
auto_approve_imported: false
|
| 282 |
+
import_eq_suggestions: false
|
| 283 |
+
|
| 284 |
+
# downloads
|
| 285 |
+
download_translations: true
|
| 286 |
+
download_language: ko
|
| 287 |
+
skip_untranslated_files: false
|
| 288 |
+
export_only_approved: true
|
| 289 |
+
|
| 290 |
+
push_translations: false
|
| 291 |
+
|
| 292 |
+
# pull-request
|
| 293 |
+
create_pull_request: false
|
| 294 |
+
|
| 295 |
+
# global options
|
| 296 |
+
config: './crowdin-config.yml'
|
| 297 |
+
base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }}
|
| 298 |
+
|
| 299 |
+
# Uncomment below to debug
|
| 300 |
+
# dryrun_action: true
|
| 301 |
+
|
| 302 |
+
###### Format JSON #####
|
| 303 |
+
# Crowdin gives the files read-only permissions, so we first have to allow
|
| 304 |
+
# writes.
|
| 305 |
+
- name: Format JSON
|
| 306 |
+
run: |
|
| 307 |
+
sudo chown -R $(whoami): client/i18n/locales
|
| 308 |
+
npx --yes prettier --write client/i18n/locales/**/*.json
|
| 309 |
+
|
| 310 |
+
###### Lowercase directory names #####
|
| 311 |
+
|
| 312 |
+
- name: Lowercase Directories
|
| 313 |
+
uses: freecodecamp/crowdin-action@36a78cbf92f5a6c05a3a32dc8bf434a19a7c59e2 # main
|
| 314 |
+
env:
|
| 315 |
+
PLUGIN: 'lowercase-directories'
|
| 316 |
+
FILE_PATH: 'client/i18n/locales'
|
| 317 |
+
# Crowdin translators might have the directories
|
| 318 |
+
# Create Commit
|
| 319 |
+
- name: Commit Changes
|
| 320 |
+
uses: freecodecamp/crowdin-action@36a78cbf92f5a6c05a3a32dc8bf434a19a7c59e2 # main
|
| 321 |
+
env:
|
| 322 |
+
PLUGIN: 'commit-changes'
|
| 323 |
+
GH_USERNAME: 'camperbot'
|
| 324 |
+
GH_EMAIL: ${{ secrets.ACTIONS_CAMPERBOT_EMAIL }}
|
| 325 |
+
GH_BRANCH: 'i18n-sync-client'
|
| 326 |
+
GH_MESSAGE: 'chore(i18n,client): processed translations'
|
| 327 |
+
|
| 328 |
+
# Generate PR #
|
| 329 |
+
# All languages should go ABOVE this. #
|
| 330 |
+
|
| 331 |
+
- name: Create PR
|
| 332 |
+
uses: freecodecamp/crowdin-action@36a78cbf92f5a6c05a3a32dc8bf434a19a7c59e2 # main
|
| 333 |
+
env:
|
| 334 |
+
PLUGIN: 'pull-request'
|
| 335 |
+
GH_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_PAT }}
|
| 336 |
+
BRANCH: 'i18n-sync-client'
|
| 337 |
+
REPOSITORY: 'freecodecamp/freecodecamp'
|
| 338 |
+
BASE: 'main'
|
| 339 |
+
TITLE: 'chore(i18n,client): processed translations'
|
| 340 |
+
BODY: 'This PR was opened auto-magically by Crowdin.'
|
| 341 |
+
LABELS: 'crowdin-sync'
|
| 342 |
+
TEAM_REVIEWERS: 'i18n'
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/crowdin-upload.client-ui.yml
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: i18n - Upload Client UI
|
| 2 |
+
on:
|
| 3 |
+
workflow_dispatch:
|
| 4 |
+
schedule:
|
| 5 |
+
# runs every weekday at 7:15 AM UTC
|
| 6 |
+
- cron: '15 7 * * 1-5'
|
| 7 |
+
|
| 8 |
+
env:
|
| 9 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 10 |
+
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }}
|
| 11 |
+
CROWDIN_API_URL: 'https://freecodecamp.crowdin.com/api/v2/'
|
| 12 |
+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_ClIENT }}
|
| 13 |
+
|
| 14 |
+
permissions:
|
| 15 |
+
contents: read
|
| 16 |
+
|
| 17 |
+
jobs:
|
| 18 |
+
i18n-upload-client-ui-files:
|
| 19 |
+
name: Client
|
| 20 |
+
runs-on: ubuntu-24.04
|
| 21 |
+
|
| 22 |
+
steps:
|
| 23 |
+
- name: Checkout Source Files
|
| 24 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
| 25 |
+
with:
|
| 26 |
+
persist-credentials: false
|
| 27 |
+
|
| 28 |
+
- name: Generate Crowdin Config
|
| 29 |
+
uses: freecodecamp/crowdin-action@36a78cbf92f5a6c05a3a32dc8bf434a19a7c59e2 # main
|
| 30 |
+
env:
|
| 31 |
+
PLUGIN: 'generate-config'
|
| 32 |
+
PROJECT_NAME: 'client'
|
| 33 |
+
|
| 34 |
+
- name: Crowdin Upload
|
| 35 |
+
uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2.17.0
|
| 36 |
+
# options: https://github.com/crowdin/github-action/blob/master/action.yml
|
| 37 |
+
with:
|
| 38 |
+
# uploads
|
| 39 |
+
upload_sources: true
|
| 40 |
+
upload_translations: false
|
| 41 |
+
auto_approve_imported: false
|
| 42 |
+
import_eq_suggestions: false
|
| 43 |
+
|
| 44 |
+
# downloads
|
| 45 |
+
download_translations: false
|
| 46 |
+
|
| 47 |
+
# pull-request
|
| 48 |
+
create_pull_request: false
|
| 49 |
+
|
| 50 |
+
# global options
|
| 51 |
+
config: './crowdin-config.yml'
|
| 52 |
+
base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }}
|
| 53 |
+
|
| 54 |
+
# Uncomment below to debug
|
| 55 |
+
# dryrun_action: true
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/crowdin-upload.curriculum.yml
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: i18n - Upload Curriculum
|
| 2 |
+
on:
|
| 3 |
+
workflow_dispatch:
|
| 4 |
+
schedule:
|
| 5 |
+
# runs every weekday at 7:30 AM UTC
|
| 6 |
+
- cron: '30 7 * * 1-5'
|
| 7 |
+
|
| 8 |
+
env:
|
| 9 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 10 |
+
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }}
|
| 11 |
+
CROWDIN_API_URL: 'https://freecodecamp.crowdin.com/api/v2/'
|
| 12 |
+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_CURRICULUM }}
|
| 13 |
+
|
| 14 |
+
permissions:
|
| 15 |
+
contents: read
|
| 16 |
+
|
| 17 |
+
jobs:
|
| 18 |
+
i18n-upload-curriculum-files:
|
| 19 |
+
name: Learn
|
| 20 |
+
runs-on: ubuntu-24.04
|
| 21 |
+
|
| 22 |
+
steps:
|
| 23 |
+
- name: Checkout Source Files
|
| 24 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
| 25 |
+
with:
|
| 26 |
+
persist-credentials: false
|
| 27 |
+
|
| 28 |
+
- name: Generate Crowdin Config
|
| 29 |
+
uses: freecodecamp/crowdin-action@36a78cbf92f5a6c05a3a32dc8bf434a19a7c59e2 # main
|
| 30 |
+
env:
|
| 31 |
+
PLUGIN: 'generate-config'
|
| 32 |
+
PROJECT_NAME: 'curriculum'
|
| 33 |
+
|
| 34 |
+
- name: Crowdin Upload
|
| 35 |
+
uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2.17.0
|
| 36 |
+
# options: https://github.com/crowdin/github-action/blob/master/action.yml
|
| 37 |
+
with:
|
| 38 |
+
# uploads
|
| 39 |
+
upload_sources: true
|
| 40 |
+
upload_translations: false
|
| 41 |
+
auto_approve_imported: false
|
| 42 |
+
import_eq_suggestions: false
|
| 43 |
+
|
| 44 |
+
# downloads
|
| 45 |
+
download_translations: false
|
| 46 |
+
|
| 47 |
+
# pull-request
|
| 48 |
+
create_pull_request: false
|
| 49 |
+
|
| 50 |
+
# global options
|
| 51 |
+
config: './crowdin-config.yml'
|
| 52 |
+
base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }}
|
| 53 |
+
|
| 54 |
+
# Uncomment below to debug
|
| 55 |
+
# dryrun_action: true
|
| 56 |
+
|
| 57 |
+
- name: Remove deleted files
|
| 58 |
+
uses: freecodecamp/crowdin-action@36a78cbf92f5a6c05a3a32dc8bf434a19a7c59e2 # main
|
| 59 |
+
env:
|
| 60 |
+
PLUGIN: 'remove-deleted-files'
|
| 61 |
+
FILE_PATHS: '["curriculum/challenges/english", "curriculum/dictionaries/english"]'
|
| 62 |
+
|
| 63 |
+
- name: Hide Non-Translated Strings
|
| 64 |
+
uses: freecodecamp/crowdin-action@36a78cbf92f5a6c05a3a32dc8bf434a19a7c59e2 # main
|
| 65 |
+
env:
|
| 66 |
+
PLUGIN: 'hide-curriculum-strings'
|
| 67 |
+
|
| 68 |
+
- name: Hide a String
|
| 69 |
+
uses: freecodecamp/crowdin-action@36a78cbf92f5a6c05a3a32dc8bf434a19a7c59e2 # main
|
| 70 |
+
env:
|
| 71 |
+
PLUGIN: 'hide-string'
|
| 72 |
+
FILE_NAME: 'basic-html-and-html5/nest-an-anchor-element-within-a-paragraph.md'
|
| 73 |
+
STRING_CONTENT: Here's a <a href="https://www.freecodecamp.org" target="_blank" mark="crwd-mark">link to www.freecodecamp.org</a> for you to follow.
|
| 74 |
+
|
| 75 |
+
- name: Unhide Title of Use && For a More Concise Conditional
|
| 76 |
+
uses: freecodecamp/crowdin-action@36a78cbf92f5a6c05a3a32dc8bf434a19a7c59e2 # main
|
| 77 |
+
env:
|
| 78 |
+
PLUGIN: 'unhide-string'
|
| 79 |
+
FILE_NAME: 'react/use--for-a-more-concise-conditional.md'
|
| 80 |
+
STRING_CONTENT: 'Use && for a More Concise Conditional'
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/curriculum-i18n-submodule.yml
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CI - Node.js - i18n - Submodule
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
# Run on push events, but only for the below branches
|
| 5 |
+
push:
|
| 6 |
+
branches:
|
| 7 |
+
- 'chore/update-i18n-curriculum-submodule'
|
| 8 |
+
workflow_dispatch:
|
| 9 |
+
|
| 10 |
+
permissions:
|
| 11 |
+
contents: read
|
| 12 |
+
|
| 13 |
+
jobs:
|
| 14 |
+
test-curriculum:
|
| 15 |
+
name: Test Curriculum
|
| 16 |
+
runs-on: ubuntu-24.04
|
| 17 |
+
strategy:
|
| 18 |
+
fail-fast: false
|
| 19 |
+
matrix:
|
| 20 |
+
node-version: [24]
|
| 21 |
+
# Exclude the languages that we currently run in the full CI suite.
|
| 22 |
+
locale:
|
| 23 |
+
- 'chinese'
|
| 24 |
+
- 'espanol'
|
| 25 |
+
- 'ukrainian'
|
| 26 |
+
- 'japanese'
|
| 27 |
+
- 'german'
|
| 28 |
+
- 'swahili'
|
| 29 |
+
- 'korean'
|
| 30 |
+
- 'arabic'
|
| 31 |
+
|
| 32 |
+
steps:
|
| 33 |
+
- name: Checkout
|
| 34 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 35 |
+
with:
|
| 36 |
+
submodules: 'recursive'
|
| 37 |
+
|
| 38 |
+
- name: Use Node.js ${{ matrix.node-version }}
|
| 39 |
+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
| 40 |
+
with:
|
| 41 |
+
node-version: ${{ matrix.node-version }}
|
| 42 |
+
|
| 43 |
+
- name: Install pnpm
|
| 44 |
+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
| 45 |
+
id: pnpm-install
|
| 46 |
+
with:
|
| 47 |
+
run_install: false
|
| 48 |
+
|
| 49 |
+
- name: Setup Turbo Cache
|
| 50 |
+
uses: ./.github/actions/setup-turbo-cache
|
| 51 |
+
with:
|
| 52 |
+
turbo-token: ${{ secrets.TURBO_TOKEN }}
|
| 53 |
+
turbo-signature-key: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
|
| 54 |
+
|
| 55 |
+
- name: Set Environment variables
|
| 56 |
+
run: |
|
| 57 |
+
sed '/^[[:space:]]*#/d; /^$/d' sample.env >> $GITHUB_ENV
|
| 58 |
+
|
| 59 |
+
- name: Install node_modules
|
| 60 |
+
run: pnpm install
|
| 61 |
+
|
| 62 |
+
# DONT REMOVE THIS STEP.
|
| 63 |
+
# TODO: Refactor and use re-usable workflow and shared artifacts
|
| 64 |
+
- name: Build Client in ${{ matrix.locale }}
|
| 65 |
+
env:
|
| 66 |
+
CURRICULUM_LOCALE: ${{ matrix.locale }}
|
| 67 |
+
CLIENT_LOCALE: ${{ matrix.locale }}
|
| 68 |
+
run: |
|
| 69 |
+
pnpm run build
|
| 70 |
+
|
| 71 |
+
- name: Install Chrome for Puppeteer
|
| 72 |
+
run: pnpm -F=curriculum install-puppeteer
|
| 73 |
+
|
| 74 |
+
- name: Run Tests
|
| 75 |
+
env:
|
| 76 |
+
CURRICULUM_LOCALE: ${{ matrix.locale }}
|
| 77 |
+
CLIENT_LOCALE: ${{ matrix.locale }}
|
| 78 |
+
run: pnpm -F=curriculum test-content
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/deploy-api.yml
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CD - Deploy - API
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_dispatch:
|
| 5 |
+
inputs:
|
| 6 |
+
api_log_lvl:
|
| 7 |
+
description: 'Log level for the API'
|
| 8 |
+
type: choice
|
| 9 |
+
options:
|
| 10 |
+
- debug
|
| 11 |
+
- info
|
| 12 |
+
- warn
|
| 13 |
+
default: debug
|
| 14 |
+
show_upcoming_changes:
|
| 15 |
+
description: 'Show upcoming changes (enables upcoming certifications and challenges)'
|
| 16 |
+
type: boolean
|
| 17 |
+
default: false
|
| 18 |
+
dump_stack_config:
|
| 19 |
+
description: 'Dump the docker stack config'
|
| 20 |
+
type: boolean
|
| 21 |
+
default: false
|
| 22 |
+
|
| 23 |
+
concurrency:
|
| 24 |
+
group: deploy-api-${{ github.ref_name }}
|
| 25 |
+
cancel-in-progress: false
|
| 26 |
+
|
| 27 |
+
jobs:
|
| 28 |
+
setup-jobs:
|
| 29 |
+
name: Setup Jobs
|
| 30 |
+
runs-on: ubuntu-24.04
|
| 31 |
+
outputs:
|
| 32 |
+
site_tld: ${{ steps.setup.outputs.site_tld }}
|
| 33 |
+
tgt_env_short: ${{ steps.setup.outputs.tgt_env_short }}
|
| 34 |
+
tgt_env_long: ${{ steps.setup.outputs.tgt_env_long }}
|
| 35 |
+
api_log_lvl: ${{ steps.setup.outputs.api_log_lvl }}
|
| 36 |
+
show_upcoming_changes: ${{ steps.setup.outputs.show_upcoming_changes }}
|
| 37 |
+
dump_stack_config: ${{ steps.setup.outputs.dump_stack_config }}
|
| 38 |
+
steps:
|
| 39 |
+
- name: Setup
|
| 40 |
+
id: setup
|
| 41 |
+
env:
|
| 42 |
+
BRANCH: ${{ github.ref_name }}
|
| 43 |
+
SHOW_UPCOMING_CHANGES: ${{ inputs.show_upcoming_changes }}
|
| 44 |
+
API_LOG_LVL: ${{ inputs.api_log_lvl || 'debug' }}
|
| 45 |
+
DUMP_STACK_CONFIG: ${{ inputs.dump_stack_config }}
|
| 46 |
+
run: |
|
| 47 |
+
echo "Current branch: $BRANCH"
|
| 48 |
+
|
| 49 |
+
# Convert boolean input to string 'true' or 'false'
|
| 50 |
+
if [[ "$SHOW_UPCOMING_CHANGES" == "true" ]]; then
|
| 51 |
+
echo "show_upcoming_changes=true" >> "$GITHUB_OUTPUT"
|
| 52 |
+
else
|
| 53 |
+
echo "show_upcoming_changes=false" >> "$GITHUB_OUTPUT"
|
| 54 |
+
fi
|
| 55 |
+
|
| 56 |
+
# Convert boolean input to string 'true' or 'false'
|
| 57 |
+
if [[ "$DUMP_STACK_CONFIG" == "true" ]]; then
|
| 58 |
+
echo "dump_stack_config=true" >> "$GITHUB_OUTPUT"
|
| 59 |
+
else
|
| 60 |
+
echo "dump_stack_config=false" >> "$GITHUB_OUTPUT"
|
| 61 |
+
fi
|
| 62 |
+
|
| 63 |
+
case "$BRANCH" in
|
| 64 |
+
"prod-current")
|
| 65 |
+
echo "site_tld=org" >> "$GITHUB_OUTPUT"
|
| 66 |
+
echo "tgt_env_short=prd" >> "$GITHUB_OUTPUT"
|
| 67 |
+
echo "tgt_env_long=production" >> "$GITHUB_OUTPUT"
|
| 68 |
+
echo "api_log_lvl=$API_LOG_LVL" >> "$GITHUB_OUTPUT"
|
| 69 |
+
;;
|
| 70 |
+
*)
|
| 71 |
+
echo "site_tld=dev" >> "$GITHUB_OUTPUT"
|
| 72 |
+
echo "tgt_env_short=stg" >> "$GITHUB_OUTPUT"
|
| 73 |
+
echo "tgt_env_long=staging" >> "$GITHUB_OUTPUT"
|
| 74 |
+
echo "api_log_lvl=$API_LOG_LVL" >> "$GITHUB_OUTPUT"
|
| 75 |
+
;;
|
| 76 |
+
esac
|
| 77 |
+
|
| 78 |
+
build:
|
| 79 |
+
name: Build & Push
|
| 80 |
+
needs: setup-jobs
|
| 81 |
+
uses: ./.github/workflows/docker-docr.yml
|
| 82 |
+
with:
|
| 83 |
+
site_tld: ${{ needs.setup-jobs.outputs.site_tld }}
|
| 84 |
+
app: api
|
| 85 |
+
show_upcoming_changes: ${{ needs.setup-jobs.outputs.show_upcoming_changes }}
|
| 86 |
+
secrets:
|
| 87 |
+
DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
| 88 |
+
DOCR_NAME: ${{ secrets.DOCR_NAME }}
|
| 89 |
+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
| 90 |
+
|
| 91 |
+
deploy:
|
| 92 |
+
name: Deploy to Docker Swarm -- ${{ needs.setup-jobs.outputs.tgt_env_short }}
|
| 93 |
+
runs-on: ubuntu-24.04
|
| 94 |
+
needs: [setup-jobs, build]
|
| 95 |
+
env:
|
| 96 |
+
TS_USERNAME: ${{ secrets.TS_USERNAME }}
|
| 97 |
+
TS_MACHINE_NAME: ${{ secrets.TS_MACHINE_NAME }}
|
| 98 |
+
permissions:
|
| 99 |
+
deployments: write
|
| 100 |
+
environment:
|
| 101 |
+
name: ${{ needs.setup-jobs.outputs.tgt_env_short }}-api
|
| 102 |
+
|
| 103 |
+
steps:
|
| 104 |
+
- name: Setup and connect to Tailscale network
|
| 105 |
+
uses: tailscale/github-action@306e68a486fd2350f2bfc3b19fcd143891a4a2d8 # v4
|
| 106 |
+
with:
|
| 107 |
+
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
|
| 108 |
+
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
|
| 109 |
+
hostname: gha-${{needs.setup-jobs.outputs.tgt_env_short}}-api-ci-${{ github.run_id }}
|
| 110 |
+
tags: tag:ci
|
| 111 |
+
version: latest
|
| 112 |
+
|
| 113 |
+
- name: Wait for Tailscale Network Readiness
|
| 114 |
+
run: |
|
| 115 |
+
echo "Waiting for Tailscale network to be ready..."
|
| 116 |
+
max_wait=60
|
| 117 |
+
elapsed=0
|
| 118 |
+
|
| 119 |
+
while [ $elapsed -lt $max_wait ]; do
|
| 120 |
+
if tailscale status --json | jq -e '.BackendState == "Running"' > /dev/null 2>&1; then
|
| 121 |
+
echo "Tailscale network is ready"
|
| 122 |
+
break
|
| 123 |
+
fi
|
| 124 |
+
sleep 2
|
| 125 |
+
elapsed=$((elapsed + 2))
|
| 126 |
+
done
|
| 127 |
+
|
| 128 |
+
if [ $elapsed -ge $max_wait ]; then
|
| 129 |
+
echo "Tailscale network not ready after ${max_wait}s"
|
| 130 |
+
exit 1
|
| 131 |
+
fi
|
| 132 |
+
|
| 133 |
+
- name: Configure SSH & Check Connection
|
| 134 |
+
run: |
|
| 135 |
+
mkdir -p ~/.ssh
|
| 136 |
+
echo "Host *
|
| 137 |
+
UserKnownHostsFile=/dev/null
|
| 138 |
+
StrictHostKeyChecking no" > ~/.ssh/config
|
| 139 |
+
chmod 644 ~/.ssh/config
|
| 140 |
+
|
| 141 |
+
scrub_ips() {
|
| 142 |
+
sed -E 's/100(\.[0-9]{1,3}){3}/100.x.x.x/g'
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
validate_connection() {
|
| 146 |
+
local machine_name=$1
|
| 147 |
+
local max_retries=3
|
| 148 |
+
local retry_delay=5
|
| 149 |
+
local ping_output ssh_output
|
| 150 |
+
|
| 151 |
+
for attempt in $(seq 1 $max_retries); do
|
| 152 |
+
echo "Connection attempt $attempt/$max_retries to $machine_name"
|
| 153 |
+
|
| 154 |
+
if ! ping_output=$(tailscale ping -c 1 --until-direct=false --timeout=5s "$machine_name" 2>&1); then
|
| 155 |
+
ping_output=$(printf '%s' "$ping_output" | scrub_ips)
|
| 156 |
+
echo "No Tailscale data path to $machine_name: $ping_output"
|
| 157 |
+
if [ "$attempt" -eq "$max_retries" ]; then
|
| 158 |
+
return 1
|
| 159 |
+
fi
|
| 160 |
+
sleep "$retry_delay"
|
| 161 |
+
continue
|
| 162 |
+
fi
|
| 163 |
+
|
| 164 |
+
MACHINE_IP=$(tailscale ip -4 "$machine_name")
|
| 165 |
+
if ssh_output=$(ssh -o ConnectTimeout=10 -o BatchMode=yes "$TS_USERNAME@$MACHINE_IP" "echo 'Connection test'; docker --version" 2>&1); then
|
| 166 |
+
echo "Successfully validated connection to $machine_name"
|
| 167 |
+
return 0
|
| 168 |
+
fi
|
| 169 |
+
|
| 170 |
+
ssh_output=$(printf '%s' "$ssh_output" | scrub_ips)
|
| 171 |
+
echo "SSH validation failed for $machine_name: $ssh_output"
|
| 172 |
+
if [ "$attempt" -lt "$max_retries" ]; then
|
| 173 |
+
sleep "$retry_delay"
|
| 174 |
+
fi
|
| 175 |
+
done
|
| 176 |
+
|
| 177 |
+
echo "Failed to establish connection to $machine_name after $max_retries attempts"
|
| 178 |
+
return 1
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
echo -e "\nLOG:Validating connection to $TS_MACHINE_NAME..."
|
| 182 |
+
if ! validate_connection "$TS_MACHINE_NAME"; then
|
| 183 |
+
echo "Error: Failed to establish reliable connection to $TS_MACHINE_NAME"
|
| 184 |
+
exit 1
|
| 185 |
+
fi
|
| 186 |
+
|
| 187 |
+
- name: Deploy with Docker Stack
|
| 188 |
+
env:
|
| 189 |
+
AGE_ENCRYPTED_ASC_SECRETS: ${{ secrets.AGE_ENCRYPTED_ASC_SECRETS }}
|
| 190 |
+
AGE_SECRET_KEY: ${{ secrets.AGE_SECRET_KEY }}
|
| 191 |
+
# Variable set from GitHub "Environment" secrets (AGE encrypted)
|
| 192 |
+
# DOCKER_REGISTRY
|
| 193 |
+
# MONGOHQ_URL
|
| 194 |
+
# SENTRY_DSN
|
| 195 |
+
# SENTRY_ENVIRONMENT
|
| 196 |
+
# AUTH0_CLIENT_ID
|
| 197 |
+
# AUTH0_CLIENT_SECRET
|
| 198 |
+
# AUTH0_DOMAIN
|
| 199 |
+
# JWT_SECRET
|
| 200 |
+
# COOKIE_SECRET
|
| 201 |
+
# COOKIE_DOMAIN
|
| 202 |
+
# SES_ID
|
| 203 |
+
# SES_SECRET
|
| 204 |
+
# SES_SMTP_USERNAME
|
| 205 |
+
# SES_SMTP_PASSWORD
|
| 206 |
+
# GROWTHBOOK_FASTIFY_API_HOST
|
| 207 |
+
# GROWTHBOOK_FASTIFY_CLIENT_KEY
|
| 208 |
+
# HOME_LOCATION
|
| 209 |
+
# API_LOCATION
|
| 210 |
+
# SOCRATES_API_KEY
|
| 211 |
+
# SOCRATES_ENDPOINT
|
| 212 |
+
# STRIPE_SECRET_KEY
|
| 213 |
+
# Variables set from SetupJob
|
| 214 |
+
DEPLOYMENT_VERSION: ${{ needs.build.outputs.tagname }}
|
| 215 |
+
DEPLOYMENT_ENV: ${{ needs.setup-jobs.outputs.tgt_env_long }}
|
| 216 |
+
DEPLOYMENT_TLD: ${{ needs.setup-jobs.outputs.site_tld }}
|
| 217 |
+
FCC_API_LOG_LEVEL: ${{ needs.setup-jobs.outputs.api_log_lvl }}
|
| 218 |
+
SHOW_UPCOMING_CHANGES: ${{ needs.setup-jobs.outputs.show_upcoming_changes }}
|
| 219 |
+
DUMP_STACK_CONFIG: ${{ needs.setup-jobs.outputs.dump_stack_config }}
|
| 220 |
+
# Stack name
|
| 221 |
+
STACK_NAME: ${{ needs.setup-jobs.outputs.tgt_env_short }}-api
|
| 222 |
+
run: |
|
| 223 |
+
REMOTE_SCRIPT="
|
| 224 |
+
set -e
|
| 225 |
+
trap 'rm -f .env age.key secrets.age.asc .env.tmp' EXIT
|
| 226 |
+
echo -e '\nLOG:Deploying API to $TS_MACHINE_NAME...'
|
| 227 |
+
cd /home/$TS_USERNAME/docker-swarm-config/stacks/api
|
| 228 |
+
|
| 229 |
+
echo -e '\nLOG:Checking if age is installed...'
|
| 230 |
+
which age > /dev/null
|
| 231 |
+
|
| 232 |
+
echo -e '\nLOG:Decrypting secrets...'
|
| 233 |
+
echo \"$AGE_ENCRYPTED_ASC_SECRETS\" > secrets.age.asc
|
| 234 |
+
echo \"$AGE_SECRET_KEY\" > age.key && chmod 600 age.key
|
| 235 |
+
age --identity age.key --decrypt secrets.age.asc > .env
|
| 236 |
+
rm -f age.key secrets.age.asc
|
| 237 |
+
|
| 238 |
+
echo -e '\nLOG:Cleaning up .env file...'
|
| 239 |
+
touch .env.tmp
|
| 240 |
+
while IFS= read -r line; do
|
| 241 |
+
if [[ \$line =~ ^[A-Za-z0-9_]+=.*$ ]]; then
|
| 242 |
+
# Extract the key (part before the first =)
|
| 243 |
+
key=\${line%%=*}
|
| 244 |
+
# Remove any previous line with this key
|
| 245 |
+
sed -i \"/^\${key}=/d\" .env.tmp
|
| 246 |
+
fi
|
| 247 |
+
# Append the current line
|
| 248 |
+
echo \"\$line\" >> .env.tmp
|
| 249 |
+
done < .env
|
| 250 |
+
mv .env.tmp .env
|
| 251 |
+
|
| 252 |
+
echo -e '\nLOG:Adding deployment variables...'
|
| 253 |
+
{
|
| 254 |
+
echo \"DEPLOYMENT_VERSION=$DEPLOYMENT_VERSION\"
|
| 255 |
+
echo \"DEPLOYMENT_TLD=$DEPLOYMENT_TLD\"
|
| 256 |
+
echo \"DEPLOYMENT_ENV=$DEPLOYMENT_ENV\"
|
| 257 |
+
echo \"FCC_API_LOG_LEVEL=$FCC_API_LOG_LEVEL\"
|
| 258 |
+
echo \"SHOW_UPCOMING_CHANGES=$SHOW_UPCOMING_CHANGES\"
|
| 259 |
+
} >> .env
|
| 260 |
+
|
| 261 |
+
echo -e '\nLOG:Sourcing environment...'
|
| 262 |
+
REQUIRED_VARS=(
|
| 263 |
+
\"DOCKER_REGISTRY\"
|
| 264 |
+
\"MONGOHQ_URL\"
|
| 265 |
+
\"SENTRY_DSN\"
|
| 266 |
+
\"SENTRY_ENVIRONMENT\"
|
| 267 |
+
\"AUTH0_CLIENT_ID\"
|
| 268 |
+
\"AUTH0_CLIENT_SECRET\"
|
| 269 |
+
\"AUTH0_DOMAIN\"
|
| 270 |
+
\"JWT_SECRET\"
|
| 271 |
+
\"COOKIE_SECRET\"
|
| 272 |
+
\"COOKIE_DOMAIN\"
|
| 273 |
+
\"SES_ID\"
|
| 274 |
+
\"SES_SECRET\"
|
| 275 |
+
\"SES_SMTP_USERNAME\"
|
| 276 |
+
\"SES_SMTP_PASSWORD\"
|
| 277 |
+
\"GROWTHBOOK_FASTIFY_API_HOST\"
|
| 278 |
+
\"GROWTHBOOK_FASTIFY_CLIENT_KEY\"
|
| 279 |
+
\"HOME_LOCATION\"
|
| 280 |
+
\"API_LOCATION\"
|
| 281 |
+
\"SOCRATES_API_KEY\"
|
| 282 |
+
\"SOCRATES_ENDPOINT\"
|
| 283 |
+
\"STRIPE_SECRET_KEY\"
|
| 284 |
+
\"DEPLOYMENT_VERSION\"
|
| 285 |
+
\"DEPLOYMENT_TLD\"
|
| 286 |
+
\"DEPLOYMENT_ENV\"
|
| 287 |
+
\"FCC_API_LOG_LEVEL\"
|
| 288 |
+
)
|
| 289 |
+
|
| 290 |
+
while IFS='=' read -r key value; do
|
| 291 |
+
if [[ -n \"\$key\" && ! \"\$key\" =~ ^# ]]; then
|
| 292 |
+
export \"\${key}=\${value}\"
|
| 293 |
+
fi
|
| 294 |
+
done < .env
|
| 295 |
+
|
| 296 |
+
MISSING_VARS=()
|
| 297 |
+
for var in \"\${REQUIRED_VARS[@]}\"; do
|
| 298 |
+
if [[ -z \"\${!var}\" ]]; then
|
| 299 |
+
MISSING_VARS+=(\"\$var\")
|
| 300 |
+
fi
|
| 301 |
+
done
|
| 302 |
+
|
| 303 |
+
if [[ \${#MISSING_VARS[@]} -gt 0 ]]; then
|
| 304 |
+
echo \"ERROR: The following required environment variables are missing or empty:\"
|
| 305 |
+
for var in \"\${MISSING_VARS[@]}\"; do
|
| 306 |
+
echo \" - \$var\"
|
| 307 |
+
done
|
| 308 |
+
exit 1
|
| 309 |
+
fi
|
| 310 |
+
|
| 311 |
+
rm -rf .env
|
| 312 |
+
|
| 313 |
+
echo -e '\nLOG:Validating deployment version...'
|
| 314 |
+
if [[ \"\$DEPLOYMENT_VERSION\" != \"$DEPLOYMENT_VERSION\" ]]; then
|
| 315 |
+
echo \"Error: Version mismatch. Expected: $DEPLOYMENT_VERSION, Got: \$DEPLOYMENT_VERSION\"
|
| 316 |
+
exit 1
|
| 317 |
+
fi
|
| 318 |
+
env | grep -E 'DEPLOYMENT_VERSION'
|
| 319 |
+
|
| 320 |
+
echo -e '\nLOG:Checking stack configuration...'
|
| 321 |
+
CONFIG_OUTPUT=\"/dev/null\"
|
| 322 |
+
if [[ \"$DUMP_STACK_CONFIG\" == \"true\" ]]; then
|
| 323 |
+
CONFIG_FILENAME=\"docker-stack-config-\${DEPLOYMENT_VERSION}.yml\"
|
| 324 |
+
echo -e '\nLOG:Saving stack configuration for debugging...'
|
| 325 |
+
CONFIG_OUTPUT=\"\$CONFIG_FILENAME\"
|
| 326 |
+
fi
|
| 327 |
+
docker stack config -c stack-api.yml > \$CONFIG_OUTPUT
|
| 328 |
+
|
| 329 |
+
echo -e '\nLOG:Deploying stack...'
|
| 330 |
+
docker stack deploy -c stack-api.yml --prune --with-registry-auth --detach=false $STACK_NAME
|
| 331 |
+
|
| 332 |
+
echo -e '\nLOG:Finished deployment.'
|
| 333 |
+
"
|
| 334 |
+
MACHINE_IP=$(tailscale ip -4 "$TS_MACHINE_NAME")
|
| 335 |
+
# shellcheck disable=SC2029 # client-side expansion of REMOTE_SCRIPT is intended
|
| 336 |
+
ssh "$TS_USERNAME@$MACHINE_IP" "$REMOTE_SCRIPT"
|
| 337 |
+
|
| 338 |
+
# TODO(o11y): Sentry release finalize disabled pending a follow-up PR with
|
| 339 |
+
# a stable release-id scheme (source-map upload in docker-docr.yml is
|
| 340 |
+
# disabled alongside). Re-enabling should also gate on a rollback-safe
|
| 341 |
+
# convergence check (docker service state) before finalizing, since
|
| 342 |
+
# `docker stack deploy --detach=false` exits 0 through a healthcheck
|
| 343 |
+
# rollback. See .scratchpad/o11y-cutover-review-2026-07-10.md.
|
| 344 |
+
# - name: Finalize Sentry release
|
| 345 |
+
# env:
|
| 346 |
+
# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
| 347 |
+
# SENTRY_ORG: freecodecamp
|
| 348 |
+
# SENTRY_PROJECT: api-fastify
|
| 349 |
+
# RELEASE: ${{ needs.build.outputs.tagname }}
|
| 350 |
+
# DEPLOY_ENV: ${{ needs.setup-jobs.outputs.tgt_env_long }}
|
| 351 |
+
# run: |
|
| 352 |
+
# npx --yes @sentry/cli@3.6.0 releases finalize "$RELEASE"
|
| 353 |
+
# npx --yes @sentry/cli@3.6.0 releases deploys "$RELEASE" new -e "$DEPLOY_ENV"
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/deploy-client.yml
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CD - Deploy - Clients
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_dispatch:
|
| 5 |
+
inputs:
|
| 6 |
+
target_language:
|
| 7 |
+
description: 'Target language (or "all" for all languages)'
|
| 8 |
+
type: choice
|
| 9 |
+
options:
|
| 10 |
+
- all
|
| 11 |
+
- english
|
| 12 |
+
- chinese
|
| 13 |
+
- espanol
|
| 14 |
+
- chinese-traditional
|
| 15 |
+
- italian
|
| 16 |
+
- portuguese
|
| 17 |
+
- ukrainian
|
| 18 |
+
- japanese
|
| 19 |
+
- german
|
| 20 |
+
- swahili
|
| 21 |
+
- korean
|
| 22 |
+
- arabic
|
| 23 |
+
default: all
|
| 24 |
+
show_upcoming_changes:
|
| 25 |
+
description: 'Show upcoming changes (enables upcoming certifications and challenges)'
|
| 26 |
+
type: boolean
|
| 27 |
+
default: false
|
| 28 |
+
|
| 29 |
+
concurrency:
|
| 30 |
+
group: deploy-client-${{ github.ref_name }}
|
| 31 |
+
cancel-in-progress: false
|
| 32 |
+
|
| 33 |
+
jobs:
|
| 34 |
+
setup-jobs:
|
| 35 |
+
name: Setup Jobs
|
| 36 |
+
runs-on: ubuntu-24.04
|
| 37 |
+
outputs:
|
| 38 |
+
site_tld: ${{ steps.setup.outputs.site_tld }} # org, dev
|
| 39 |
+
tgt_env_short: ${{ steps.setup.outputs.tgt_env_short }} # prd, stg
|
| 40 |
+
tgt_env_long: ${{ steps.setup.outputs.tgt_env_long }} # production, staging
|
| 41 |
+
tgt_env_branch: ${{ steps.setup.outputs.tgt_env_branch }} # prod-current, prod-staging
|
| 42 |
+
show_upcoming_changes: ${{ steps.setup.outputs.show_upcoming_changes }}
|
| 43 |
+
steps:
|
| 44 |
+
- name: Setup
|
| 45 |
+
id: setup
|
| 46 |
+
env:
|
| 47 |
+
BRANCH: ${{ github.ref_name }}
|
| 48 |
+
SHOW_UPCOMING_CHANGES: ${{ inputs.show_upcoming_changes }}
|
| 49 |
+
run: |
|
| 50 |
+
echo "Current branch: $BRANCH"
|
| 51 |
+
|
| 52 |
+
# Convert boolean input to string 'true' or 'false'
|
| 53 |
+
if [[ "$SHOW_UPCOMING_CHANGES" == "true" ]]; then
|
| 54 |
+
echo "show_upcoming_changes=true" >> $GITHUB_OUTPUT
|
| 55 |
+
else
|
| 56 |
+
echo "show_upcoming_changes=false" >> $GITHUB_OUTPUT
|
| 57 |
+
fi
|
| 58 |
+
|
| 59 |
+
case "$BRANCH" in
|
| 60 |
+
"prod-current")
|
| 61 |
+
echo "site_tld=org" >> $GITHUB_OUTPUT
|
| 62 |
+
echo "tgt_env_short=prd" >> $GITHUB_OUTPUT
|
| 63 |
+
echo "tgt_env_long=production" >> $GITHUB_OUTPUT
|
| 64 |
+
echo "tgt_env_branch=prod-current" >> $GITHUB_OUTPUT
|
| 65 |
+
;;
|
| 66 |
+
*)
|
| 67 |
+
echo "site_tld=dev" >> $GITHUB_OUTPUT
|
| 68 |
+
echo "tgt_env_short=stg" >> $GITHUB_OUTPUT
|
| 69 |
+
echo "tgt_env_long=staging" >> $GITHUB_OUTPUT
|
| 70 |
+
echo "tgt_env_branch=prod-staging" >> $GITHUB_OUTPUT
|
| 71 |
+
;;
|
| 72 |
+
esac
|
| 73 |
+
|
| 74 |
+
setup-matrix:
|
| 75 |
+
name: Setup Matrix
|
| 76 |
+
runs-on: ubuntu-24.04
|
| 77 |
+
needs: setup-jobs
|
| 78 |
+
outputs:
|
| 79 |
+
matrix: ${{ steps.matrix.outputs.matrix }}
|
| 80 |
+
steps:
|
| 81 |
+
- name: Setup Matrix
|
| 82 |
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 83 |
+
id: matrix
|
| 84 |
+
env:
|
| 85 |
+
TARGET_LANG: ${{ inputs.target_language }}
|
| 86 |
+
with:
|
| 87 |
+
script: |
|
| 88 |
+
// Constants
|
| 89 |
+
const NODE_VERSION = 24;
|
| 90 |
+
|
| 91 |
+
// Input sanitization and validation
|
| 92 |
+
const rawTargetLang = process.env.TARGET_LANG || 'all';
|
| 93 |
+
const targetLang = rawTargetLang.trim().toLowerCase();
|
| 94 |
+
console.log(`Target language: ${targetLang}`);
|
| 95 |
+
|
| 96 |
+
// Language mappings (single source of truth)
|
| 97 |
+
const languageMap = {
|
| 98 |
+
'english': 'eng',
|
| 99 |
+
'chinese': 'chn',
|
| 100 |
+
'espanol': 'esp',
|
| 101 |
+
'chinese-traditional': 'cnt',
|
| 102 |
+
'italian': 'ita',
|
| 103 |
+
'portuguese': 'por',
|
| 104 |
+
'ukrainian': 'ukr',
|
| 105 |
+
'japanese': 'jpn',
|
| 106 |
+
'german': 'ger',
|
| 107 |
+
'swahili': 'swa',
|
| 108 |
+
'korean': 'kor',
|
| 109 |
+
'arabic': 'ara'
|
| 110 |
+
};
|
| 111 |
+
|
| 112 |
+
const allLanguages = Object.keys(languageMap);
|
| 113 |
+
let matrix;
|
| 114 |
+
|
| 115 |
+
if (targetLang === 'all') {
|
| 116 |
+
console.log('Building matrix for all languages');
|
| 117 |
+
console.log(`Available languages: ${allLanguages.join(', ')}`);
|
| 118 |
+
|
| 119 |
+
// Build include array for all languages
|
| 120 |
+
const include = allLanguages.map(lang => ({
|
| 121 |
+
'node-version': NODE_VERSION,
|
| 122 |
+
'lang-name-full': lang,
|
| 123 |
+
'lang-name-short': languageMap[lang]
|
| 124 |
+
}));
|
| 125 |
+
|
| 126 |
+
matrix = {
|
| 127 |
+
include: include
|
| 128 |
+
};
|
| 129 |
+
|
| 130 |
+
} else {
|
| 131 |
+
console.log(`Building matrix for single language: ${targetLang}`);
|
| 132 |
+
|
| 133 |
+
// Validate language selection
|
| 134 |
+
if (!languageMap[targetLang]) {
|
| 135 |
+
const errorMsg = `Unknown language '${targetLang}'. Available: ${allLanguages.join(', ')}`;
|
| 136 |
+
console.error(errorMsg);
|
| 137 |
+
core.setFailed(errorMsg);
|
| 138 |
+
return;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
console.log(`Processing: ${targetLang} -> ${languageMap[targetLang]}`);
|
| 142 |
+
|
| 143 |
+
// Create single language matrix
|
| 144 |
+
matrix = {
|
| 145 |
+
include: [{
|
| 146 |
+
'node-version': NODE_VERSION,
|
| 147 |
+
'lang-name-full': targetLang,
|
| 148 |
+
'lang-name-short': languageMap[targetLang]
|
| 149 |
+
}]
|
| 150 |
+
};
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
// Final validation
|
| 154 |
+
if (!matrix || !matrix.include || matrix.include.length === 0) {
|
| 155 |
+
core.setFailed('Generated matrix is empty or invalid');
|
| 156 |
+
return;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
console.log('Generated matrix:');
|
| 160 |
+
console.log(JSON.stringify(matrix, null, 2));
|
| 161 |
+
console.log(`Matrix will create ${matrix.include.length} job(s)`);
|
| 162 |
+
|
| 163 |
+
// Set output for GitHub Actions
|
| 164 |
+
core.setOutput('matrix', JSON.stringify(matrix));
|
| 165 |
+
|
| 166 |
+
client:
|
| 167 |
+
name: Clients - [${{ needs.setup-jobs.outputs.tgt_env_short }}] [${{ matrix.lang-name-short }}]
|
| 168 |
+
needs: [setup-jobs, setup-matrix]
|
| 169 |
+
runs-on: ubuntu-24.04
|
| 170 |
+
strategy:
|
| 171 |
+
fail-fast: false
|
| 172 |
+
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
|
| 173 |
+
permissions:
|
| 174 |
+
deployments: write
|
| 175 |
+
contents: read
|
| 176 |
+
environment:
|
| 177 |
+
name: ${{ needs.setup-jobs.outputs.tgt_env_short }}-clients
|
| 178 |
+
env:
|
| 179 |
+
TS_USERNAME: ${{ secrets.TS_USERNAME }}
|
| 180 |
+
TS_MACHINE_NAME_PREFIX: ${{ secrets.TS_MACHINE_NAME_PREFIX }}
|
| 181 |
+
|
| 182 |
+
steps:
|
| 183 |
+
- name: Checkout
|
| 184 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 185 |
+
with:
|
| 186 |
+
submodules: 'recursive'
|
| 187 |
+
|
| 188 |
+
- name: Use Node.js ${{ matrix.node-version }}
|
| 189 |
+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
| 190 |
+
with:
|
| 191 |
+
node-version: ${{ matrix.node-version }}
|
| 192 |
+
|
| 193 |
+
- name: Install pnpm
|
| 194 |
+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
| 195 |
+
id: pnpm-install
|
| 196 |
+
with:
|
| 197 |
+
run_install: false
|
| 198 |
+
|
| 199 |
+
- name: Language specific ENV - [${{ matrix.lang-name-full }}]
|
| 200 |
+
run: |
|
| 201 |
+
if [ "${{ matrix.lang-name-full }}" = "english" ]; then
|
| 202 |
+
echo "HOME_LOCATION=https://www.freecodecamp.${{ needs.setup-jobs.outputs.site_tld }}" >> $GITHUB_ENV
|
| 203 |
+
echo "NEWS_LOCATION=https://www.freecodecamp.${{ needs.setup-jobs.outputs.site_tld }}/news" >> $GITHUB_ENV
|
| 204 |
+
else
|
| 205 |
+
echo "HOME_LOCATION=https://www.freecodecamp.${{ needs.setup-jobs.outputs.site_tld }}/${{ matrix.lang-name-full }}" >> $GITHUB_ENV
|
| 206 |
+
echo "NEWS_LOCATION=https://www.freecodecamp.${{ needs.setup-jobs.outputs.site_tld }}/${{ matrix.lang-name-full }}/news" >> $GITHUB_ENV
|
| 207 |
+
fi
|
| 208 |
+
echo "CLIENT_LOCALE=${{ matrix.lang-name-full }}" >> $GITHUB_ENV
|
| 209 |
+
echo "CURRICULUM_LOCALE=${{ matrix.lang-name-full }}" >> $GITHUB_ENV
|
| 210 |
+
|
| 211 |
+
- name: Create deployment version
|
| 212 |
+
id: deployment-version
|
| 213 |
+
run: |
|
| 214 |
+
DEPLOYMENT_VERSION=$(git rev-parse --short HEAD)-$(date +%Y%m%d)-$(date +%H%M)
|
| 215 |
+
echo "DEPLOYMENT_VERSION=$DEPLOYMENT_VERSION" >> $GITHUB_ENV
|
| 216 |
+
echo "DEPLOYMENT_VERSION=$DEPLOYMENT_VERSION" >> $GITHUB_OUTPUT
|
| 217 |
+
|
| 218 |
+
- name: Install and Build
|
| 219 |
+
env:
|
| 220 |
+
API_LOCATION: 'https://api.freecodecamp.${{ needs.setup-jobs.outputs.site_tld }}'
|
| 221 |
+
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
|
| 222 |
+
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
|
| 223 |
+
GROWTHBOOK_URI: ${{ secrets.GROWTHBOOK_URI }}
|
| 224 |
+
FORUM_LOCATION: 'https://forum.freecodecamp.org'
|
| 225 |
+
PATREON_CLIENT_ID: ${{ secrets.PATREON_CLIENT_ID }}
|
| 226 |
+
PAYPAL_CLIENT_ID: ${{ secrets.PAYPAL_CLIENT_ID }}
|
| 227 |
+
STRIPE_PUBLIC_KEY: ${{ secrets.STRIPE_PUBLIC_KEY }}
|
| 228 |
+
SHOW_UPCOMING_CHANGES: ${{ needs.setup-jobs.outputs.show_upcoming_changes }}
|
| 229 |
+
FREECODECAMP_NODE_ENV: production
|
| 230 |
+
# The below is used in ecosystem.config.js file for the API -- to be removed later
|
| 231 |
+
DEPLOYMENT_ENV: ${{ needs.setup-jobs.outputs.tgt_env_long }}
|
| 232 |
+
# The above is used in ecosystem.config.js file for the API -- to be removed later
|
| 233 |
+
run: |
|
| 234 |
+
pnpm install
|
| 235 |
+
pnpm run build
|
| 236 |
+
|
| 237 |
+
- name: Free up space
|
| 238 |
+
run: pnpm run clean:packages
|
| 239 |
+
|
| 240 |
+
- name: Tar Files
|
| 241 |
+
run: tar -czf client-${{ matrix.lang-name-short }}.tar client/public
|
| 242 |
+
|
| 243 |
+
- name: Setup and connect to Tailscale network
|
| 244 |
+
uses: tailscale/github-action@306e68a486fd2350f2bfc3b19fcd143891a4a2d8 # v4
|
| 245 |
+
with:
|
| 246 |
+
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
|
| 247 |
+
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
|
| 248 |
+
hostname: gha-${{needs.setup-jobs.outputs.tgt_env_short}}-clients-ci-${{ github.run_id }}
|
| 249 |
+
tags: tag:ci
|
| 250 |
+
version: latest
|
| 251 |
+
|
| 252 |
+
- name: Wait for Tailscale Network Readiness
|
| 253 |
+
run: |
|
| 254 |
+
echo "Waiting for Tailscale network to be ready..."
|
| 255 |
+
max_wait=60
|
| 256 |
+
elapsed=0
|
| 257 |
+
|
| 258 |
+
while [ $elapsed -lt $max_wait ]; do
|
| 259 |
+
if tailscale status --json | jq -e '.BackendState == "Running"' > /dev/null 2>&1; then
|
| 260 |
+
echo "Tailscale network is ready"
|
| 261 |
+
break
|
| 262 |
+
fi
|
| 263 |
+
sleep 2
|
| 264 |
+
elapsed=$((elapsed + 2))
|
| 265 |
+
done
|
| 266 |
+
|
| 267 |
+
if [ $elapsed -ge $max_wait ]; then
|
| 268 |
+
echo "Tailscale network not ready after ${max_wait}s"
|
| 269 |
+
exit 1
|
| 270 |
+
fi
|
| 271 |
+
|
| 272 |
+
- name: Configure SSH & Check Connection
|
| 273 |
+
run: |
|
| 274 |
+
mkdir -p ~/.ssh
|
| 275 |
+
echo "Host *
|
| 276 |
+
UserKnownHostsFile=/dev/null
|
| 277 |
+
StrictHostKeyChecking no" > ~/.ssh/config
|
| 278 |
+
chmod 644 ~/.ssh/config
|
| 279 |
+
|
| 280 |
+
scrub_ips() {
|
| 281 |
+
sed -E 's/100(\.[0-9]{1,3}){3}/100.x.x.x/g'
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
validate_connection() {
|
| 285 |
+
local machine_name=$1
|
| 286 |
+
local max_retries=3
|
| 287 |
+
local retry_delay=5
|
| 288 |
+
local ping_output ssh_output
|
| 289 |
+
|
| 290 |
+
for attempt in $(seq 1 $max_retries); do
|
| 291 |
+
echo "Connection attempt $attempt/$max_retries to $machine_name"
|
| 292 |
+
|
| 293 |
+
if ! ping_output=$(tailscale ping -c 1 --until-direct=false --timeout=5s "$machine_name" 2>&1); then
|
| 294 |
+
ping_output=$(printf '%s' "$ping_output" | scrub_ips)
|
| 295 |
+
echo "No Tailscale data path to $machine_name: $ping_output"
|
| 296 |
+
if [ $attempt -eq $max_retries ]; then
|
| 297 |
+
return 1
|
| 298 |
+
fi
|
| 299 |
+
sleep $retry_delay
|
| 300 |
+
continue
|
| 301 |
+
fi
|
| 302 |
+
|
| 303 |
+
MACHINE_IP=$(tailscale ip -4 $machine_name)
|
| 304 |
+
if ssh_output=$(ssh -o ConnectTimeout=10 -o BatchMode=yes $TS_USERNAME@$MACHINE_IP "echo 'Connection test'; uptime" 2>&1); then
|
| 305 |
+
echo "Successfully validated connection to $machine_name"
|
| 306 |
+
return 0
|
| 307 |
+
fi
|
| 308 |
+
|
| 309 |
+
ssh_output=$(printf '%s' "$ssh_output" | scrub_ips)
|
| 310 |
+
echo "SSH validation failed for $machine_name: $ssh_output"
|
| 311 |
+
if [ $attempt -lt $max_retries ]; then
|
| 312 |
+
sleep $retry_delay
|
| 313 |
+
fi
|
| 314 |
+
done
|
| 315 |
+
|
| 316 |
+
echo "Failed to establish connection to $machine_name after $max_retries attempts"
|
| 317 |
+
return 1
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
echo -e "\nLOG:Validating connections to all machines..."
|
| 321 |
+
for i in {0..1}; do
|
| 322 |
+
TS_MACHINE_NAME=${TS_MACHINE_NAME_PREFIX}-${{ matrix.lang-name-short }}-${i}
|
| 323 |
+
echo "Validating connection to $TS_MACHINE_NAME"
|
| 324 |
+
if ! validate_connection "$TS_MACHINE_NAME"; then
|
| 325 |
+
echo "Error: Failed to establish reliable connection to $TS_MACHINE_NAME"
|
| 326 |
+
exit 1
|
| 327 |
+
fi
|
| 328 |
+
done
|
| 329 |
+
echo "All machine connections validated successfully"
|
| 330 |
+
|
| 331 |
+
- name: Upload and Deploy
|
| 332 |
+
run: |
|
| 333 |
+
for i in {0..1}; do
|
| 334 |
+
TS_MACHINE_NAME=${TS_MACHINE_NAME_PREFIX}-${{ matrix.lang-name-short }}-${i}
|
| 335 |
+
CURRENT_DATE=$(date +%Y%m%d)
|
| 336 |
+
CLIENT_SRC=client-${{ matrix.lang-name-short }}.tar
|
| 337 |
+
CLIENT_DST=/tmp/client-${{ matrix.lang-name-short }}-${CURRENT_DATE}-${{ github.run_id }}.tar
|
| 338 |
+
CLIENT_BINARIES=${{needs.setup-jobs.outputs.tgt_env_short}}-release-$CURRENT_DATE-${{ github.run_id }}
|
| 339 |
+
|
| 340 |
+
echo -e "\nLOG:Uploading client archive to $TS_MACHINE_NAME..."
|
| 341 |
+
MACHINE_IP=$(tailscale ip -4 $TS_MACHINE_NAME)
|
| 342 |
+
scp $CLIENT_SRC $TS_USERNAME@$MACHINE_IP:$CLIENT_DST
|
| 343 |
+
|
| 344 |
+
REMOTE_SCRIPT="
|
| 345 |
+
set -e
|
| 346 |
+
echo -e '\nLOG: Deploying client - $CLIENT_BINARIES to $TS_MACHINE_NAME...'
|
| 347 |
+
|
| 348 |
+
echo -e '\nLOG:Extracting client archive...'
|
| 349 |
+
mkdir -p /home/$TS_USERNAME/client/releases/$CLIENT_BINARIES
|
| 350 |
+
tar -xzf $CLIENT_DST -C /home/$TS_USERNAME/client/releases/$CLIENT_BINARIES --strip-components=2
|
| 351 |
+
|
| 352 |
+
echo -e '\nLOG:Cleaning up client archive...'
|
| 353 |
+
rm $CLIENT_DST
|
| 354 |
+
|
| 355 |
+
echo -e '\nLOG:Checking client archive size...'
|
| 356 |
+
du -sh /home/$TS_USERNAME/client/releases/$CLIENT_BINARIES
|
| 357 |
+
|
| 358 |
+
echo -e '\nLOG:Environment setup...'
|
| 359 |
+
cd /home/$TS_USERNAME/client
|
| 360 |
+
export NVM_DIR=\$HOME/.nvm && [ -s "\$NVM_DIR/nvm.sh" ] && source "\$NVM_DIR/nvm.sh"
|
| 361 |
+
echo -e '\nLOG:Checking available Node.js versions...'
|
| 362 |
+
nvm ls | grep 'default'
|
| 363 |
+
echo -e '\nLOG:Checking Node.js version...'
|
| 364 |
+
node --version
|
| 365 |
+
|
| 366 |
+
echo -e '\nLOG:Installing serve...'
|
| 367 |
+
npm install -g serve@13
|
| 368 |
+
|
| 369 |
+
echo -e '\nLOG:Primary client setup...'
|
| 370 |
+
rm -f client-start-primary.sh
|
| 371 |
+
echo \"serve -c ../../serve.json releases/$CLIENT_BINARIES -p 50505\" >> client-start-primary.sh
|
| 372 |
+
chmod +x client-start-primary.sh
|
| 373 |
+
pm2 delete client-primary || true
|
| 374 |
+
pm2 start ./client-start-primary.sh --name client-primary
|
| 375 |
+
echo -e '\nLOG:Primary client setup completed.'
|
| 376 |
+
|
| 377 |
+
pm2 ls
|
| 378 |
+
|
| 379 |
+
echo -e '\nLOG:Secondary client setup...'
|
| 380 |
+
rm -f client-start-secondary.sh
|
| 381 |
+
echo \"serve -c ../../serve.json releases/$CLIENT_BINARIES -p 52525\" >> client-start-secondary.sh
|
| 382 |
+
chmod +x client-start-secondary.sh
|
| 383 |
+
pm2 delete client-secondary || true
|
| 384 |
+
pm2 start ./client-start-secondary.sh --name client-secondary
|
| 385 |
+
echo -e '\nLOG:Secondary client setup completed.'
|
| 386 |
+
|
| 387 |
+
pm2 ls
|
| 388 |
+
pm2 save
|
| 389 |
+
|
| 390 |
+
echo -e '\nLOG:Finished deployment.'
|
| 391 |
+
"
|
| 392 |
+
ssh $TS_USERNAME@$MACHINE_IP "$REMOTE_SCRIPT"
|
| 393 |
+
done
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/devcontainer-ci.yml
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CI - Devcontainer
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
paths:
|
| 6 |
+
- '.devcontainer/**'
|
| 7 |
+
- 'docker/devcontainer/**'
|
| 8 |
+
- 'docker/docker-compose.yml'
|
| 9 |
+
- '.github/workflows/devcontainer-ci.yml'
|
| 10 |
+
- 'sample.env'
|
| 11 |
+
- 'package.json'
|
| 12 |
+
- 'turbo.json'
|
| 13 |
+
- 'pnpm-lock.yaml'
|
| 14 |
+
- 'client/package.json'
|
| 15 |
+
- 'client/turbo.json'
|
| 16 |
+
workflow_dispatch:
|
| 17 |
+
|
| 18 |
+
concurrency:
|
| 19 |
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
| 20 |
+
cancel-in-progress: true
|
| 21 |
+
|
| 22 |
+
permissions:
|
| 23 |
+
contents: read
|
| 24 |
+
|
| 25 |
+
jobs:
|
| 26 |
+
validate:
|
| 27 |
+
name: Validate
|
| 28 |
+
runs-on: ubuntu-24.04
|
| 29 |
+
|
| 30 |
+
steps:
|
| 31 |
+
- name: Checkout
|
| 32 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 33 |
+
|
| 34 |
+
- name: Set up Docker Buildx
|
| 35 |
+
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4
|
| 36 |
+
|
| 37 |
+
- name: Install devcontainer CLI
|
| 38 |
+
# renovate: datasource=npm depName=@devcontainers/cli
|
| 39 |
+
run: npm install -g @devcontainers/cli@0.83.0
|
| 40 |
+
|
| 41 |
+
- name: Build the devcontainer image from this branch
|
| 42 |
+
uses: docker/bake-action@d3418bd7d0e9324001bca92fa8ba175ea7e6dc9b # v7
|
| 43 |
+
with:
|
| 44 |
+
files: docker/devcontainer/docker-bake.hcl
|
| 45 |
+
targets: local-devcontainer
|
| 46 |
+
load: true
|
| 47 |
+
|
| 48 |
+
- name: Start devcontainer
|
| 49 |
+
run: devcontainer up --workspace-folder .
|
| 50 |
+
|
| 51 |
+
- name: Validate required tools
|
| 52 |
+
run: |
|
| 53 |
+
devcontainer exec --workspace-folder . pnpm --version
|
| 54 |
+
devcontainer exec --workspace-folder . rsync --version
|
| 55 |
+
devcontainer exec --workspace-folder . mongosh --version
|
| 56 |
+
devcontainer exec --workspace-folder . node --version
|
| 57 |
+
devcontainer exec --workspace-folder . git --version
|
| 58 |
+
devcontainer exec --workspace-folder . gh --version
|
| 59 |
+
|
| 60 |
+
- name: Validate MongoDB is writable
|
| 61 |
+
run: |
|
| 62 |
+
for i in $(seq 1 30); do
|
| 63 |
+
if devcontainer exec --workspace-folder . mongosh --quiet --eval 'if (!db.hello().isWritablePrimary) quit(1)'; then
|
| 64 |
+
echo "Replica set is writable"
|
| 65 |
+
exit 0
|
| 66 |
+
fi
|
| 67 |
+
echo "Waiting for a writable primary... (attempt $i/30)"
|
| 68 |
+
sleep 2
|
| 69 |
+
done
|
| 70 |
+
echo "Replica set failed to initialize"
|
| 71 |
+
exit 1
|
| 72 |
+
|
| 73 |
+
- name: Validate Mailpit is reachable
|
| 74 |
+
run: |
|
| 75 |
+
devcontainer exec --workspace-folder . bash -c 'exec 3<>/dev/tcp/localhost/1025 && head -1 <&3'
|
| 76 |
+
devcontainer exec --workspace-folder . bash -c 'exec 3<>/dev/tcp/localhost/8025'
|
| 77 |
+
|
| 78 |
+
- name: Validate the generated .env
|
| 79 |
+
run: |
|
| 80 |
+
devcontainer exec --workspace-folder . grep -q '^MAILPIT_HOST=localhost$' .env
|
| 81 |
+
devcontainer exec --workspace-folder . grep -q '^HOME_LOCATION=http://localhost:8000$' .env
|
| 82 |
+
|
| 83 |
+
- name: Validate the client answers on IPv4 loopback
|
| 84 |
+
run: |
|
| 85 |
+
devcontainer exec --workspace-folder . bash -c '
|
| 86 |
+
FCC_SUPERBLOCK=responsive-web-design pnpm run develop > /tmp/develop.log 2>&1 &
|
| 87 |
+
pid=$!
|
| 88 |
+
deadline=$((SECONDS + 2400))
|
| 89 |
+
while [ "$SECONDS" -lt "$deadline" ]; do
|
| 90 |
+
if ! kill -0 "$pid" 2>/dev/null; then
|
| 91 |
+
echo "pnpm run develop exited before the client answered"
|
| 92 |
+
cat /tmp/develop.log
|
| 93 |
+
exit 1
|
| 94 |
+
fi
|
| 95 |
+
if curl -sf -o /dev/null --max-time 10 http://127.0.0.1:8000/; then
|
| 96 |
+
echo "The client answers on 127.0.0.1:8000"
|
| 97 |
+
exit 0
|
| 98 |
+
fi
|
| 99 |
+
sleep 5
|
| 100 |
+
done
|
| 101 |
+
echo "The client never answered on 127.0.0.1:8000"
|
| 102 |
+
cat /tmp/develop.log
|
| 103 |
+
exit 1'
|
| 104 |
+
|
| 105 |
+
- name: Validate the Codespaces URL rewrite
|
| 106 |
+
run: |
|
| 107 |
+
devcontainer exec --workspace-folder . env \
|
| 108 |
+
CODESPACE_NAME=ci-probe \
|
| 109 |
+
GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN=app.github.dev \
|
| 110 |
+
.devcontainer/codespace-env.sh
|
| 111 |
+
devcontainer exec --workspace-folder . grep -q '^HOME_LOCATION=https://ci-probe-8000.app.github.dev$' .env
|
| 112 |
+
devcontainer exec --workspace-folder . grep -q '^API_LOCATION=https://ci-probe-3000.app.github.dev$' .env
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/docker-docr-cleanup.yml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CD - Docker - DOCR Cleanup Container Images
|
| 2 |
+
on:
|
| 3 |
+
workflow_dispatch:
|
| 4 |
+
schedule:
|
| 5 |
+
- cron: '5 0 * * 3,6' # 12:05 UTC on Wednesdays and Saturdays (6 hour maintenance window)
|
| 6 |
+
|
| 7 |
+
jobs:
|
| 8 |
+
remove:
|
| 9 |
+
name: Delete Old Images
|
| 10 |
+
runs-on: ubuntu-latest
|
| 11 |
+
strategy:
|
| 12 |
+
fail-fast: false
|
| 13 |
+
matrix:
|
| 14 |
+
repos:
|
| 15 |
+
- learn-api
|
| 16 |
+
variants:
|
| 17 |
+
- dev
|
| 18 |
+
- org
|
| 19 |
+
|
| 20 |
+
steps:
|
| 21 |
+
- name: Install doctl
|
| 22 |
+
uses: digitalocean/action-doctl@3cb3953159719656269e044e0e24ca16dd2a690f # v2.5.2
|
| 23 |
+
with:
|
| 24 |
+
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
| 25 |
+
|
| 26 |
+
- name: Log in to DigitalOcean Container Registry with short-lived credentials
|
| 27 |
+
run: doctl registry login --expiry-seconds 1200
|
| 28 |
+
|
| 29 |
+
- name: Delete Images
|
| 30 |
+
uses: raisedadead/action-docr-cleanup@1c7d87369bccfdf5da03a9ae3b00eacc3f2a9b51 # v1
|
| 31 |
+
with:
|
| 32 |
+
repository_name: '${{ matrix.variants }}/${{ matrix.repos }}'
|
| 33 |
+
days: '7'
|
| 34 |
+
keep_last: '3'
|
| 35 |
+
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/docker-docr.yml
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CD - Docker - DOCR
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_dispatch:
|
| 5 |
+
inputs:
|
| 6 |
+
site_tld:
|
| 7 |
+
required: true
|
| 8 |
+
type: choice
|
| 9 |
+
description: 'Input: The site tld (variant) to build'
|
| 10 |
+
options:
|
| 11 |
+
- dev
|
| 12 |
+
- org
|
| 13 |
+
default: 'dev'
|
| 14 |
+
app:
|
| 15 |
+
required: true
|
| 16 |
+
type: string
|
| 17 |
+
description: 'Input: The app (component) to build'
|
| 18 |
+
default: 'api'
|
| 19 |
+
show_upcoming_changes:
|
| 20 |
+
required: false
|
| 21 |
+
type: string
|
| 22 |
+
description: 'Input: Show upcoming changes flag (true/false)'
|
| 23 |
+
default: 'false'
|
| 24 |
+
workflow_call:
|
| 25 |
+
inputs:
|
| 26 |
+
site_tld:
|
| 27 |
+
required: true
|
| 28 |
+
type: string
|
| 29 |
+
description: 'Input: The site tld (variant) to build'
|
| 30 |
+
app:
|
| 31 |
+
required: true
|
| 32 |
+
type: string
|
| 33 |
+
description: 'Input: The app (component) to build'
|
| 34 |
+
show_upcoming_changes:
|
| 35 |
+
required: false
|
| 36 |
+
type: string
|
| 37 |
+
description: 'Input: Show upcoming changes flag (true/false)'
|
| 38 |
+
default: 'false'
|
| 39 |
+
secrets:
|
| 40 |
+
DIGITALOCEAN_ACCESS_TOKEN:
|
| 41 |
+
required: true
|
| 42 |
+
description: 'DigitalOcean API token for registry authentication'
|
| 43 |
+
DOCR_NAME:
|
| 44 |
+
required: true
|
| 45 |
+
description: 'DigitalOcean Container Registry name'
|
| 46 |
+
SENTRY_AUTH_TOKEN:
|
| 47 |
+
required: false
|
| 48 |
+
description: 'Sentry auth token for source map upload (api app only)'
|
| 49 |
+
outputs:
|
| 50 |
+
tagname:
|
| 51 |
+
description: 'Output: The tagname for the image built'
|
| 52 |
+
value: ${{ jobs.build.outputs.tagname }}
|
| 53 |
+
|
| 54 |
+
jobs:
|
| 55 |
+
build:
|
| 56 |
+
name: Build & Push
|
| 57 |
+
runs-on: ubuntu-24.04
|
| 58 |
+
permissions:
|
| 59 |
+
contents: read
|
| 60 |
+
outputs:
|
| 61 |
+
tagname: ${{ steps.tagname.outputs.tagname }}
|
| 62 |
+
|
| 63 |
+
steps:
|
| 64 |
+
- name: Checkout Source Files
|
| 65 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
| 66 |
+
|
| 67 |
+
- name: Create a tagname
|
| 68 |
+
id: tagname
|
| 69 |
+
run: |
|
| 70 |
+
tagname=$(git rev-parse --short HEAD)-$(date +%Y%m%d)-$(date +%H%M)
|
| 71 |
+
echo "tagname=$tagname" >> "$GITHUB_ENV"
|
| 72 |
+
echo "tagname=$tagname" >> "$GITHUB_OUTPUT"
|
| 73 |
+
|
| 74 |
+
- name: Set up Docker Buildx
|
| 75 |
+
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4
|
| 76 |
+
|
| 77 |
+
- name: Install doctl
|
| 78 |
+
uses: digitalocean/action-doctl@3cb3953159719656269e044e0e24ca16dd2a690f # v2.5.2
|
| 79 |
+
with:
|
| 80 |
+
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
| 81 |
+
|
| 82 |
+
- name: Log in to DigitalOcean Container Registry with short-lived credentials
|
| 83 |
+
run: doctl registry login --expiry-seconds 1200
|
| 84 |
+
|
| 85 |
+
- name: Build & Push Image
|
| 86 |
+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
|
| 87 |
+
with:
|
| 88 |
+
context: .
|
| 89 |
+
file: docker/${{ inputs.app }}/Dockerfile
|
| 90 |
+
push: true
|
| 91 |
+
build-args: |
|
| 92 |
+
SHOW_UPCOMING_CHANGES=${{ inputs.show_upcoming_changes }}
|
| 93 |
+
tags: |
|
| 94 |
+
registry.digitalocean.com/${{ secrets.DOCR_NAME }}/${{ inputs.site_tld }}/learn-${{ inputs.app }}:${{ env.tagname }}
|
| 95 |
+
registry.digitalocean.com/${{ secrets.DOCR_NAME }}/${{ inputs.site_tld }}/learn-${{ inputs.app }}:latest
|
| 96 |
+
cache-from: type=gha
|
| 97 |
+
cache-to: type=gha,mode=max
|
| 98 |
+
|
| 99 |
+
# TODO(o11y): source-map upload + release marking disabled pending a
|
| 100 |
+
# follow-up PR with a stable release-id scheme. Also fix the upload path
|
| 101 |
+
# when re-enabling: the image ships /home/node/fcc/api/src (dist flattened
|
| 102 |
+
# by the COPY in docker/api/Dockerfile), so `docker cp .../fcc/api` yields
|
| 103 |
+
# sentry-dist/api/src — the old upload pointed at sentry-dist/api/dist,
|
| 104 |
+
# which never exists (silent no-op, so maps never uploaded). Path below is
|
| 105 |
+
# pre-corrected to sentry-dist/api/src. See
|
| 106 |
+
# .scratchpad/o11y-cutover-review-2026-07-10.md.
|
| 107 |
+
# - name: Extract API dist for Sentry source maps
|
| 108 |
+
# if: inputs.app == 'api'
|
| 109 |
+
# run: |
|
| 110 |
+
# IMAGE="registry.digitalocean.com/${{ secrets.DOCR_NAME }}/${{ inputs.site_tld }}/learn-${{ inputs.app }}:${{ env.tagname }}"
|
| 111 |
+
# docker pull "$IMAGE"
|
| 112 |
+
# container_id=$(docker create "$IMAGE")
|
| 113 |
+
# mkdir -p sentry-dist
|
| 114 |
+
# docker cp "$container_id:/home/node/fcc/api" sentry-dist/
|
| 115 |
+
# docker rm "$container_id"
|
| 116 |
+
#
|
| 117 |
+
# - name: Upload source maps to Sentry (unfinalized)
|
| 118 |
+
# if: inputs.app == 'api'
|
| 119 |
+
# env:
|
| 120 |
+
# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
| 121 |
+
# SENTRY_ORG: freecodecamp
|
| 122 |
+
# SENTRY_PROJECT: api-fastify
|
| 123 |
+
# run: |
|
| 124 |
+
# npx --yes @sentry/cli@3.6.0 releases new "${{ env.tagname }}"
|
| 125 |
+
# npx --yes @sentry/cli@3.6.0 sourcemaps upload --release "${{ env.tagname }}" sentry-dist/api/src
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/docker-ghcr.yml
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CD - Docker - GHCR Images
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_dispatch:
|
| 5 |
+
push:
|
| 6 |
+
branches:
|
| 7 |
+
- main
|
| 8 |
+
paths:
|
| 9 |
+
- 'pnpm-lock.yaml'
|
| 10 |
+
- 'package.json'
|
| 11 |
+
- 'docker/devcontainer/**'
|
| 12 |
+
- '.github/workflows/docker-ghcr.yml'
|
| 13 |
+
|
| 14 |
+
permissions:
|
| 15 |
+
contents: read
|
| 16 |
+
packages: write
|
| 17 |
+
|
| 18 |
+
jobs:
|
| 19 |
+
build-and-push:
|
| 20 |
+
name: Build and Push Images
|
| 21 |
+
runs-on: ubuntu-24.04
|
| 22 |
+
|
| 23 |
+
steps:
|
| 24 |
+
- name: Checkout
|
| 25 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 26 |
+
with:
|
| 27 |
+
submodules: 'recursive'
|
| 28 |
+
|
| 29 |
+
- name: Set up QEMU
|
| 30 |
+
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4
|
| 31 |
+
|
| 32 |
+
- name: Set up Docker Buildx
|
| 33 |
+
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4
|
| 34 |
+
|
| 35 |
+
- name: Log in to GHCR
|
| 36 |
+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
|
| 37 |
+
with:
|
| 38 |
+
registry: ghcr.io
|
| 39 |
+
username: ${{ github.actor }}
|
| 40 |
+
password: ${{ secrets.GITHUB_TOKEN }}
|
| 41 |
+
|
| 42 |
+
- name: Build and push images
|
| 43 |
+
uses: docker/bake-action@d3418bd7d0e9324001bca92fa8ba175ea7e6dc9b # v7
|
| 44 |
+
with:
|
| 45 |
+
files: docker/devcontainer/docker-bake.hcl
|
| 46 |
+
targets: devcontainer
|
| 47 |
+
push: true
|
| 48 |
+
env:
|
| 49 |
+
TAG: ${{ github.sha }}
|
| 50 |
+
TAG_LATEST: ${{ github.ref_name == 'main' }}
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/e2e-playwright.yml
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CI - E2E - Playwright
|
| 2 |
+
on:
|
| 3 |
+
workflow_call:
|
| 4 |
+
|
| 5 |
+
permissions:
|
| 6 |
+
contents: read
|
| 7 |
+
|
| 8 |
+
jobs:
|
| 9 |
+
playwright-run:
|
| 10 |
+
name: Run Playwright Tests
|
| 11 |
+
runs-on: ubuntu-24.04
|
| 12 |
+
strategy:
|
| 13 |
+
fail-fast: false
|
| 14 |
+
matrix:
|
| 15 |
+
# Extend this to include firefox and webkit once chromium is working.
|
| 16 |
+
browsers: [chromium]
|
| 17 |
+
node-version: [24]
|
| 18 |
+
|
| 19 |
+
steps:
|
| 20 |
+
- name: Set Action Environment Variables
|
| 21 |
+
run: |
|
| 22 |
+
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
|
| 23 |
+
|
| 24 |
+
- name: Checkout Source Files
|
| 25 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 26 |
+
with:
|
| 27 |
+
persist-credentials: false
|
| 28 |
+
|
| 29 |
+
- name: Download Client Artifact
|
| 30 |
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
| 31 |
+
with:
|
| 32 |
+
name: client-artifact
|
| 33 |
+
path: client/public
|
| 34 |
+
|
| 35 |
+
- name: Checkout client-config
|
| 36 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 37 |
+
with:
|
| 38 |
+
repository: freeCodeCamp/client-config
|
| 39 |
+
path: client-config
|
| 40 |
+
persist-credentials: false
|
| 41 |
+
|
| 42 |
+
- name: Move serve.json to Public Folder
|
| 43 |
+
run: cp client-config/serve.json client/public/serve.json
|
| 44 |
+
|
| 45 |
+
- name: Download Api Artifact
|
| 46 |
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
| 47 |
+
with:
|
| 48 |
+
name: api-artifact
|
| 49 |
+
path: api-artifact
|
| 50 |
+
|
| 51 |
+
- name: Load API Image
|
| 52 |
+
run: |
|
| 53 |
+
docker load < api-artifact/api-artifact.tar
|
| 54 |
+
rm api-artifact/api-artifact.tar
|
| 55 |
+
|
| 56 |
+
- name: Use Node.js ${{ matrix.node-version }}
|
| 57 |
+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
| 58 |
+
with:
|
| 59 |
+
node-version: ${{ matrix.node-version }}
|
| 60 |
+
|
| 61 |
+
- name: Install pnpm
|
| 62 |
+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
| 63 |
+
id: pnpm-install
|
| 64 |
+
with:
|
| 65 |
+
run_install: false
|
| 66 |
+
|
| 67 |
+
- name: Install Dependencies
|
| 68 |
+
run: pnpm install
|
| 69 |
+
|
| 70 |
+
- name: Set freeCodeCamp Environment Variables (needed by api)
|
| 71 |
+
run: |
|
| 72 |
+
sed '/^[[:space:]]*#/d; /^$/d' sample.env >> $GITHUB_ENV
|
| 73 |
+
cp sample.env .env # for docker compose
|
| 74 |
+
|
| 75 |
+
- name: Install playwright dependencies
|
| 76 |
+
run: npx playwright install --with-deps
|
| 77 |
+
|
| 78 |
+
- name: Install
|
| 79 |
+
run: pnpm install
|
| 80 |
+
|
| 81 |
+
- name: Start apps
|
| 82 |
+
run: |
|
| 83 |
+
docker compose -f docker/docker-compose.yml -f docker/docker-compose.ports.yml -f docker/docker-compose.e2e.yml up -d
|
| 84 |
+
pnpm run serve:client-ci &
|
| 85 |
+
sleep 10
|
| 86 |
+
|
| 87 |
+
- name: Seed Database with Certified User
|
| 88 |
+
run: pnpm run seed:certified-user
|
| 89 |
+
|
| 90 |
+
- name: Run playwright tests
|
| 91 |
+
run: pnpm run playwright:run --project=${{ matrix.browsers }}
|
| 92 |
+
|
| 93 |
+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
| 94 |
+
if: ${{ !cancelled() }}
|
| 95 |
+
with:
|
| 96 |
+
name: playwright-report-${{ matrix.browsers }}
|
| 97 |
+
path: e2e/playwright/reporter
|
| 98 |
+
retention-days: 7
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/github-autoclose.yml
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: GitHub - Autoclose Invalid PRs
|
| 2 |
+
on:
|
| 3 |
+
pull_request_target:
|
| 4 |
+
branches:
|
| 5 |
+
- 'main'
|
| 6 |
+
paths:
|
| 7 |
+
- '.gitignore'
|
| 8 |
+
|
| 9 |
+
permissions:
|
| 10 |
+
issues: write
|
| 11 |
+
pull-requests: write
|
| 12 |
+
jobs:
|
| 13 |
+
autoclose:
|
| 14 |
+
runs-on: ubuntu-24.04
|
| 15 |
+
steps:
|
| 16 |
+
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 17 |
+
with:
|
| 18 |
+
github-token: ${{secrets.GITHUB_TOKEN}}
|
| 19 |
+
script: |
|
| 20 |
+
const files = await github.rest.pulls.listFiles({
|
| 21 |
+
owner: context.payload.repository.owner.login,
|
| 22 |
+
repo: context.payload.repository.name,
|
| 23 |
+
pull_number: context.payload.pull_request.number,
|
| 24 |
+
});
|
| 25 |
+
if (
|
| 26 |
+
files.data.length !== 1 ||
|
| 27 |
+
(files.data[0].filename !== ".gitignore" &&
|
| 28 |
+
// We've had four PRs make this same (irrelevant) change already.
|
| 29 |
+
!(files.data[0].filename === "664ef4623946e65e18d59764.md" &&
|
| 30 |
+
files.data[0].patch.includes("return re.sub('(?<!\d)1', '', equation_string.strip('+'))")
|
| 31 |
+
)
|
| 32 |
+
)
|
| 33 |
+
) {
|
| 34 |
+
return;
|
| 35 |
+
}
|
| 36 |
+
const creator = context.payload.sender.login;
|
| 37 |
+
const opts = github.rest.issues.listForRepo.endpoint.merge({
|
| 38 |
+
...context.issue,
|
| 39 |
+
creator,
|
| 40 |
+
state: 'all'
|
| 41 |
+
});
|
| 42 |
+
const issues = await github.paginate(opts);
|
| 43 |
+
|
| 44 |
+
// iterate through issues
|
| 45 |
+
for (const issue of issues) {
|
| 46 |
+
// if the issue is this one, keep looking
|
| 47 |
+
if (issue.number === context.issue.number) {
|
| 48 |
+
continue;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
// if the issue is actually a PR, they're not a first timer
|
| 52 |
+
if (issue.pull_request) {
|
| 53 |
+
return // Creator is already a contributor.
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
core.setFailed("Invalid PR detected.");
|
| 57 |
+
await github.rest.issues.createComment({
|
| 58 |
+
issue_number: context.issue.number,
|
| 59 |
+
owner: context.repo.owner,
|
| 60 |
+
repo: context.repo.repo,
|
| 61 |
+
body: "Thank you for opening this pull request.\n\nThis is a standard message notifying you that we've reviewed your pull request and have decided not to merge it. We would welcome future pull requests from you.\n\nThank you and happy coding.",
|
| 62 |
+
});
|
| 63 |
+
await github.rest.pulls.update({
|
| 64 |
+
owner: context.payload.repository.owner.login,
|
| 65 |
+
repo: context.payload.repository.name,
|
| 66 |
+
pull_number: context.payload.pull_request.number,
|
| 67 |
+
state: "closed"
|
| 68 |
+
});
|
| 69 |
+
await github.rest.issues.addLabels({
|
| 70 |
+
owner: context.payload.repository.owner.login,
|
| 71 |
+
repo: context.payload.repository.name,
|
| 72 |
+
issue_number: context.issue.number,
|
| 73 |
+
labels: ["spam"]
|
| 74 |
+
});
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/github-labeler.yaml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: GitHub - Label PRs
|
| 2 |
+
on:
|
| 3 |
+
- pull_request_target
|
| 4 |
+
|
| 5 |
+
permissions:
|
| 6 |
+
contents: read
|
| 7 |
+
|
| 8 |
+
concurrency:
|
| 9 |
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.workflow_run.head_branch || github.ref }}
|
| 10 |
+
cancel-in-progress: true
|
| 11 |
+
|
| 12 |
+
jobs:
|
| 13 |
+
triage:
|
| 14 |
+
permissions:
|
| 15 |
+
# for actions/labeler to determine modified files
|
| 16 |
+
contents: read
|
| 17 |
+
# for actions/labeler to add labels to PRs
|
| 18 |
+
pull-requests: write
|
| 19 |
+
runs-on: ubuntu-24.04
|
| 20 |
+
steps:
|
| 21 |
+
- uses: actions/labeler@b8dd2d9be0f68b860e7dae5dae7d772984eacd6d # v6
|
| 22 |
+
with:
|
| 23 |
+
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
| 24 |
+
sync-labels: true
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/github-lock-closed-prs.yml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: GitHub - Lock Closed PRs
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request_target:
|
| 5 |
+
types: [closed]
|
| 6 |
+
|
| 7 |
+
permissions:
|
| 8 |
+
issues: write
|
| 9 |
+
pull-requests: write
|
| 10 |
+
jobs:
|
| 11 |
+
lock:
|
| 12 |
+
name: Lock Closed PR
|
| 13 |
+
runs-on: ubuntu-24.04
|
| 14 |
+
steps:
|
| 15 |
+
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 16 |
+
with:
|
| 17 |
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
| 18 |
+
script: |
|
| 19 |
+
await github.rest.issues.lock({
|
| 20 |
+
owner: context.repo.owner,
|
| 21 |
+
repo: context.repo.repo,
|
| 22 |
+
issue_number: context.issue.number,
|
| 23 |
+
lock_reason: 'resolved'
|
| 24 |
+
});
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/github-no-i18n-via-prs.yml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: GitHub - No translations via PRs
|
| 2 |
+
on:
|
| 3 |
+
pull_request_target:
|
| 4 |
+
branches:
|
| 5 |
+
- 'main'
|
| 6 |
+
paths:
|
| 7 |
+
- 'client/i18n/locales/**/intro.json'
|
| 8 |
+
- 'client/i18n/locales/**/translations.json'
|
| 9 |
+
- '!client/i18n/locales/english/**'
|
| 10 |
+
|
| 11 |
+
jobs:
|
| 12 |
+
has-translation:
|
| 13 |
+
runs-on: ubuntu-24.04
|
| 14 |
+
steps:
|
| 15 |
+
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 16 |
+
with:
|
| 17 |
+
github-token: ${{secrets.CAMPERBOT_NO_TRANSLATE}}
|
| 18 |
+
script: |
|
| 19 |
+
const isDev = await github.rest.teams.getMembershipForUserInOrg({
|
| 20 |
+
org: "freeCodeCamp",
|
| 21 |
+
team_slug: "dev-team",
|
| 22 |
+
username: context.payload.pull_request.user.login
|
| 23 |
+
}).catch(() => ({status: 404}));
|
| 24 |
+
if (context.payload.pull_request.user.login !== "camperbot" && isDev.status !== 200) {
|
| 25 |
+
core.setFailed('This PR appears to touch translated curriculum files.')
|
| 26 |
+
await github.rest.issues.createComment({
|
| 27 |
+
issue_number: context.issue.number,
|
| 28 |
+
owner: context.repo.owner,
|
| 29 |
+
repo: context.repo.repo,
|
| 30 |
+
body: "Thanks for your pull request.\n\n**Please remove the changes made to the non-English versions of the files. No need to close this pull request; just add more commits as needed.**\n\nWe require you to change **only English** versions of files in the codebase. Translations to corresponding files in other world languages are managed on our translation platform. Once your pull request is merged, changes will be synced automatically to other world languages.\n\nPlease visit [our contributing guidelines](https://contribute.freecodecamp.org) to learn more about translating freeCodeCamp's resources.\n\nAs always, we value all of your contributions.\n\nHappy contributing!\n\n---\n_**Note:** This message was automatically generated by a bot. If you feel this message is in error or would like help resolving it, feel free to reach us [in our contributor chat](https://discord.gg/PRyKn3Vbay)._"
|
| 31 |
+
})
|
| 32 |
+
} else if (isDev.status === 200) {
|
| 33 |
+
core.setFailed('This PR appears to touch translated curriculum files, but since you are on the dev team there is no message.');
|
| 34 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/github-pr-guidelines.yml
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: GitHub - PR Contribution Guidelines
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request_target:
|
| 5 |
+
types: [opened, reopened, edited]
|
| 6 |
+
|
| 7 |
+
jobs:
|
| 8 |
+
# Ensures PR commits were not added via the GitHub Web UI, which typically indicates
|
| 9 |
+
# the contributor hasn't tested their changes in a local development environment.
|
| 10 |
+
no-web-commits:
|
| 11 |
+
name: No Commits on GitHub Web
|
| 12 |
+
runs-on: ubuntu-24.04
|
| 13 |
+
outputs:
|
| 14 |
+
is_allow_listed: ${{ steps.pr_author.outputs.is_allow_listed }}
|
| 15 |
+
steps:
|
| 16 |
+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 17 |
+
with:
|
| 18 |
+
sparse-checkout: .github/scripts/pr-guidelines
|
| 19 |
+
sparse-checkout-cone-mode: false
|
| 20 |
+
|
| 21 |
+
- name: Check if PR author is allow-listed
|
| 22 |
+
id: pr_author
|
| 23 |
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 24 |
+
with:
|
| 25 |
+
# GITHUB_TOKEN does not have the read:org permission needed for this call
|
| 26 |
+
# while CAMPERBOT_NO_TRANSLATE does, since it is a PAT for the camperbot account with read:org scope
|
| 27 |
+
github-token: ${{ secrets.CAMPERBOT_NO_TRANSLATE }}
|
| 28 |
+
script: |
|
| 29 |
+
const fn = require('./.github/scripts/pr-guidelines/check-allow-list.js');
|
| 30 |
+
await fn({ github, context, core });
|
| 31 |
+
|
| 32 |
+
- name: Check if commits are made on GitHub Web UI
|
| 33 |
+
id: check-commits
|
| 34 |
+
if: steps.pr_author.outputs.is_allow_listed == 'false' && github.event.action != 'edited'
|
| 35 |
+
env:
|
| 36 |
+
HEAD_REF: ${{ github.head_ref }}
|
| 37 |
+
run: |
|
| 38 |
+
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
|
| 39 |
+
COMMITS_URL="https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/commits"
|
| 40 |
+
HAS_GITHUB_SIGNED_COMMIT=$(curl --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "$COMMITS_URL" | jq '[.[] | select(.commit.committer.name == "GitHub") | select(.commit.message | test("revert"; "i") | not)] | length > 0')
|
| 41 |
+
# GitHub Codespaces also produces GitHub-signed commits, but Codespaces users
|
| 42 |
+
# work on descriptively named branches. The web editor defaults to patch-N branches.
|
| 43 |
+
IS_PATCH_BRANCH=false
|
| 44 |
+
if [[ "$HEAD_REF" =~ ^patch-[0-9]+$ ]]; then
|
| 45 |
+
IS_PATCH_BRANCH=true
|
| 46 |
+
fi
|
| 47 |
+
if [ "$HAS_GITHUB_SIGNED_COMMIT" = "true" ] && [ "$IS_PATCH_BRANCH" = "true" ]; then
|
| 48 |
+
echo "IS_GITHUB_COMMIT=true" >> $GITHUB_ENV
|
| 49 |
+
fi
|
| 50 |
+
|
| 51 |
+
- name: Add comment on PR if commits are made on GitHub Web UI
|
| 52 |
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 53 |
+
if: steps.pr_author.outputs.is_allow_listed == 'false' && env.IS_GITHUB_COMMIT == 'true' && github.event.action != 'edited'
|
| 54 |
+
with:
|
| 55 |
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
| 56 |
+
script: |
|
| 57 |
+
core.setFailed("Commits were added via the GitHub Web UI.");
|
| 58 |
+
await github.rest.issues.createComment({
|
| 59 |
+
issue_number: context.issue.number,
|
| 60 |
+
owner: context.repo.owner,
|
| 61 |
+
repo: context.repo.repo,
|
| 62 |
+
body: "Thanks for your pull request.\n\n**Please do not add commits via the GitHub Web UI.**\n\nIt generally means you have yet to test these changes in a development setup or complete any prerequisites. We need you to follow the guides mentioned in the checklist. Please revalidate these changes in a developer environment and confirm how you validated your changes.\n\nHappy contributing!\n\n---\n_**Note:** This message was automatically generated by a bot. If you feel this message is in error or would like help resolving it, feel free to reach us [in our contributor chat](https://discord.gg/PRyKn3Vbay)._"
|
| 63 |
+
});
|
| 64 |
+
|
| 65 |
+
- name: Add deprioritized label
|
| 66 |
+
if: failure()
|
| 67 |
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 68 |
+
with:
|
| 69 |
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
| 70 |
+
script: |
|
| 71 |
+
await github.rest.issues.addLabels({
|
| 72 |
+
owner: context.repo.owner,
|
| 73 |
+
repo: context.repo.repo,
|
| 74 |
+
issue_number: context.issue.number,
|
| 75 |
+
labels: ['deprioritized']
|
| 76 |
+
});
|
| 77 |
+
|
| 78 |
+
# Ensures PRs are not opened directly from the contributor's main branch, which makes
|
| 79 |
+
# it hard to keep the PR up to date as the upstream repository progresses.
|
| 80 |
+
# Kept as a standalone job so it does not depend on the web-commit checks.
|
| 81 |
+
no-main-branch:
|
| 82 |
+
name: No PRs from Main Branch
|
| 83 |
+
runs-on: ubuntu-24.04
|
| 84 |
+
steps:
|
| 85 |
+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 86 |
+
with:
|
| 87 |
+
sparse-checkout: .github/scripts/pr-guidelines
|
| 88 |
+
sparse-checkout-cone-mode: false
|
| 89 |
+
|
| 90 |
+
- name: Check if PR author is allow-listed
|
| 91 |
+
id: pr_author
|
| 92 |
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 93 |
+
with:
|
| 94 |
+
# GITHUB_TOKEN does not have the read:org permission needed for this call
|
| 95 |
+
# while CAMPERBOT_NO_TRANSLATE does, since it is a PAT for the camperbot account with read:org scope
|
| 96 |
+
github-token: ${{ secrets.CAMPERBOT_NO_TRANSLATE }}
|
| 97 |
+
script: |
|
| 98 |
+
const fn = require('./.github/scripts/pr-guidelines/check-allow-list.js');
|
| 99 |
+
await fn({ github, context, core });
|
| 100 |
+
|
| 101 |
+
- name: Check if PR is opened from the main branch
|
| 102 |
+
id: check-main-branch
|
| 103 |
+
if: steps.pr_author.outputs.is_allow_listed == 'false'
|
| 104 |
+
env:
|
| 105 |
+
HEAD_REF: ${{ github.head_ref }}
|
| 106 |
+
run: |
|
| 107 |
+
if [ "$HEAD_REF" = "main" ]; then
|
| 108 |
+
echo "IS_MAIN_BRANCH=true" >> $GITHUB_ENV
|
| 109 |
+
fi
|
| 110 |
+
|
| 111 |
+
- name: Add comment on PR if head branch is main
|
| 112 |
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 113 |
+
if: steps.pr_author.outputs.is_allow_listed == 'false' && env.IS_MAIN_BRANCH == 'true' && github.event.action != 'edited'
|
| 114 |
+
with:
|
| 115 |
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
| 116 |
+
script: |
|
| 117 |
+
await github.rest.issues.createComment({
|
| 118 |
+
issue_number: context.issue.number,
|
| 119 |
+
owner: context.repo.owner,
|
| 120 |
+
repo: context.repo.repo,
|
| 121 |
+
body: "Thanks for your pull request.\n\n**We recommend opening pull requests from a dedicated branch rather than your `main` branch.**\n\nUsing a separate branch for each change lets you work on multiple things at the same time without them interfering with one another. Since this PR is opened from your `main` branch, any new commits you push to `main` will be added to this PR while it stays open. After it is merged, you will need to reset your `main` branch as described in the [basic Git workflow guide](https://contribute.freecodecamp.org/basic-git-workflow/) to keep it in sync with the upstream repository.\n\nHappy contributing!\n\n---\n_**Note:** This message was automatically generated by a bot. If you feel this message is in error or would like help resolving it, feel free to reach us [in our contributor chat](https://discord.gg/PRyKn3Vbay)._"
|
| 122 |
+
});
|
| 123 |
+
|
| 124 |
+
- name: Fail if head branch is main
|
| 125 |
+
if: steps.pr_author.outputs.is_allow_listed == 'false' && env.IS_MAIN_BRANCH == 'true'
|
| 126 |
+
run: exit 1
|
| 127 |
+
|
| 128 |
+
- name: Add deprioritized label
|
| 129 |
+
if: failure()
|
| 130 |
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 131 |
+
with:
|
| 132 |
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
| 133 |
+
script: |
|
| 134 |
+
await github.rest.issues.addLabels({
|
| 135 |
+
owner: context.repo.owner,
|
| 136 |
+
repo: context.repo.repo,
|
| 137 |
+
issue_number: context.issue.number,
|
| 138 |
+
labels: ['deprioritized']
|
| 139 |
+
});
|
| 140 |
+
|
| 141 |
+
# Normalizes PR titles to follow Conventional Commits format, applying fuzzy fixes
|
| 142 |
+
# for common mistakes like typos, missing colons, or incorrect spacing.
|
| 143 |
+
fix-pr-title:
|
| 144 |
+
name: Fix PR Title
|
| 145 |
+
runs-on: ubuntu-24.04
|
| 146 |
+
needs: [no-web-commits, no-main-branch]
|
| 147 |
+
if: needs.no-web-commits.result == 'success' && needs.no-main-branch.result == 'success' && github.event.action != 'edited'
|
| 148 |
+
steps:
|
| 149 |
+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 150 |
+
with:
|
| 151 |
+
sparse-checkout: .github/scripts/pr-guidelines
|
| 152 |
+
sparse-checkout-cone-mode: false
|
| 153 |
+
|
| 154 |
+
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 155 |
+
with:
|
| 156 |
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
| 157 |
+
script: |
|
| 158 |
+
const fn = require('./.github/scripts/pr-guidelines/fix-pr-title.js');
|
| 159 |
+
await fn({ github, context });
|
| 160 |
+
|
| 161 |
+
# Checks that the PR description still contains the required template.
|
| 162 |
+
# The first 3 checkboxes must be ticked ([x] or [X]).
|
| 163 |
+
# The last checkbox (tested locally) is acceptable to leave unticked
|
| 164 |
+
# but removing the entire template is not.
|
| 165 |
+
check-pr-template:
|
| 166 |
+
name: Check PR Template
|
| 167 |
+
runs-on: ubuntu-24.04
|
| 168 |
+
needs: [no-web-commits, no-main-branch]
|
| 169 |
+
if: needs.no-web-commits.result == 'success' && needs.no-main-branch.result == 'success'
|
| 170 |
+
outputs:
|
| 171 |
+
failure_reason: ${{ steps.check.outputs.failure_reason }}
|
| 172 |
+
steps:
|
| 173 |
+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 174 |
+
with:
|
| 175 |
+
sparse-checkout: .github/scripts/pr-guidelines
|
| 176 |
+
sparse-checkout-cone-mode: false
|
| 177 |
+
|
| 178 |
+
- id: check
|
| 179 |
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 180 |
+
with:
|
| 181 |
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
| 182 |
+
script: |
|
| 183 |
+
const fn = require('./.github/scripts/pr-guidelines/check-pr-template.js');
|
| 184 |
+
await fn({ github, context, core, isAllowListed: '${{ needs.no-web-commits.outputs.is_allow_listed }}' });
|
| 185 |
+
|
| 186 |
+
# Coordinates reporting: posts a single combined comment when checks fail,
|
| 187 |
+
# or removes the deprioritized label when all checks pass.
|
| 188 |
+
report:
|
| 189 |
+
name: Report
|
| 190 |
+
runs-on: ubuntu-24.04
|
| 191 |
+
needs: [no-web-commits, no-main-branch, check-pr-template]
|
| 192 |
+
if: always() && needs.no-web-commits.result == 'success' && needs.no-main-branch.result == 'success'
|
| 193 |
+
steps:
|
| 194 |
+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 195 |
+
with:
|
| 196 |
+
sparse-checkout: .github/scripts/pr-guidelines
|
| 197 |
+
sparse-checkout-cone-mode: false
|
| 198 |
+
|
| 199 |
+
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 200 |
+
with:
|
| 201 |
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
| 202 |
+
script: |
|
| 203 |
+
const fn = require('./.github/scripts/pr-guidelines/report-results.js');
|
| 204 |
+
await fn({
|
| 205 |
+
github,
|
| 206 |
+
context,
|
| 207 |
+
templateResult: '${{ needs.check-pr-template.result }}',
|
| 208 |
+
templateReason: '${{ needs.check-pr-template.outputs.failure_reason }}'
|
| 209 |
+
});
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/github-spam.yml
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: GitHub - Spam PR
|
| 2 |
+
on:
|
| 3 |
+
pull_request_target:
|
| 4 |
+
types:
|
| 5 |
+
- labeled
|
| 6 |
+
|
| 7 |
+
permissions: {}
|
| 8 |
+
jobs:
|
| 9 |
+
is-spam:
|
| 10 |
+
runs-on: ubuntu-24.04
|
| 11 |
+
steps:
|
| 12 |
+
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 13 |
+
with:
|
| 14 |
+
github-token: ${{secrets.CAMPERBOT_NO_TRANSLATE}}
|
| 15 |
+
script: |
|
| 16 |
+
if (context.payload.label.name === "spam") {
|
| 17 |
+
try {
|
| 18 |
+
await github.rest.issues.createComment({
|
| 19 |
+
issue_number: context.issue.number,
|
| 20 |
+
owner: context.repo.owner,
|
| 21 |
+
repo: context.repo.repo,
|
| 22 |
+
body: "We are marking this pull request as spam. Please note that if you are participating in Hacktoberfest, two or more PRs marked as spam will result in your permanent disqualification.\n\nIf you are interested in making quality and genuine contributions to our projects, check out our [contributing guidelines](https://contribute.freecodecamp.org)."
|
| 23 |
+
});
|
| 24 |
+
} catch {
|
| 25 |
+
// Conversation may already be locked — ignore.
|
| 26 |
+
}
|
| 27 |
+
}
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/i18n-validate-builds.yml
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: i18n - Build Validation
|
| 2 |
+
on:
|
| 3 |
+
push:
|
| 4 |
+
branches:
|
| 5 |
+
- main
|
| 6 |
+
|
| 7 |
+
concurrency:
|
| 8 |
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.workflow_run.head_branch || github.ref }}
|
| 9 |
+
cancel-in-progress: true
|
| 10 |
+
|
| 11 |
+
jobs:
|
| 12 |
+
ci:
|
| 13 |
+
name: Validate i18n Builds
|
| 14 |
+
runs-on: ubuntu-24.04
|
| 15 |
+
strategy:
|
| 16 |
+
matrix:
|
| 17 |
+
node-version: [24]
|
| 18 |
+
|
| 19 |
+
steps:
|
| 20 |
+
- name: Checkout
|
| 21 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 22 |
+
with:
|
| 23 |
+
submodules: 'recursive'
|
| 24 |
+
|
| 25 |
+
- name: Use Node.js ${{ matrix.node-version }}
|
| 26 |
+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
| 27 |
+
with:
|
| 28 |
+
node-version: ${{ matrix.node-version }}
|
| 29 |
+
|
| 30 |
+
- name: Install pnpm
|
| 31 |
+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
| 32 |
+
id: pnpm-install
|
| 33 |
+
with:
|
| 34 |
+
run_install: false
|
| 35 |
+
|
| 36 |
+
- name: Setup Turbo Cache
|
| 37 |
+
uses: ./.github/actions/setup-turbo-cache
|
| 38 |
+
with:
|
| 39 |
+
turbo-token: ${{ secrets.TURBO_TOKEN }}
|
| 40 |
+
turbo-signature-key: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
|
| 41 |
+
|
| 42 |
+
- name: Set freeCodeCamp Environment Variables
|
| 43 |
+
run: |
|
| 44 |
+
sed '/^[[:space:]]*#/d; /^$/d' sample.env >> $GITHUB_ENV
|
| 45 |
+
|
| 46 |
+
- name: Install Dependencies
|
| 47 |
+
run: pnpm install
|
| 48 |
+
|
| 49 |
+
- name: Validate Challenge Files
|
| 50 |
+
run: pnpm run audit-challenges
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/i18n-validate-prs.yml
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: i18n - Curriculum PR Validation
|
| 2 |
+
on:
|
| 3 |
+
pull_request:
|
| 4 |
+
branches:
|
| 5 |
+
- main
|
| 6 |
+
|
| 7 |
+
concurrency:
|
| 8 |
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.workflow_run.head_branch || github.ref }}
|
| 9 |
+
cancel-in-progress: true
|
| 10 |
+
|
| 11 |
+
jobs:
|
| 12 |
+
ci:
|
| 13 |
+
name: Validate i18n Builds
|
| 14 |
+
# run only on PRs that camperbot opens with title that matches the curriculum sync
|
| 15 |
+
if: ${{ github.event.pull_request.user.login == 'camperbot' && contains(github.event.pull_request.title, 'chore(i18n,learn)') }}
|
| 16 |
+
runs-on: ubuntu-24.04
|
| 17 |
+
strategy:
|
| 18 |
+
matrix:
|
| 19 |
+
node-version: [24]
|
| 20 |
+
|
| 21 |
+
steps:
|
| 22 |
+
- name: Checkout
|
| 23 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 24 |
+
with:
|
| 25 |
+
submodules: 'recursive'
|
| 26 |
+
|
| 27 |
+
- name: Use Node.js ${{ matrix.node-version }}
|
| 28 |
+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
| 29 |
+
with:
|
| 30 |
+
node-version: ${{ matrix.node-version }}
|
| 31 |
+
|
| 32 |
+
- name: Install pnpm
|
| 33 |
+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
| 34 |
+
id: pnpm-install
|
| 35 |
+
with:
|
| 36 |
+
run_install: false
|
| 37 |
+
|
| 38 |
+
- name: Set freeCodeCamp Environment Variables
|
| 39 |
+
run: |
|
| 40 |
+
sed '/^[[:space:]]*#/d; /^$/d' sample.env >> $GITHUB_ENV
|
| 41 |
+
|
| 42 |
+
- name: Install Dependencies
|
| 43 |
+
run: pnpm install
|
| 44 |
+
|
| 45 |
+
- name: Validate Challenge Files
|
| 46 |
+
id: validate
|
| 47 |
+
run: pnpm run audit-challenges
|
| 48 |
+
|
| 49 |
+
- name: Create Comment
|
| 50 |
+
# Run if the validate challenge files step fails, specifically. Note that we need the failure() call for this step to trigger if the action fails.
|
| 51 |
+
if: ${{ failure() && steps.validate.conclusion == 'failure' }}
|
| 52 |
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
| 53 |
+
with:
|
| 54 |
+
github-token: ${{secrets.CAMPERBOT_NO_TRANSLATE}}
|
| 55 |
+
script: |
|
| 56 |
+
await github.rest.issues.createComment({
|
| 57 |
+
issue_number: context.issue.number,
|
| 58 |
+
owner: context.repo.owner,
|
| 59 |
+
repo: context.repo.repo,
|
| 60 |
+
body: "Hey @freecodecamp/i18n, it looks like we have new English curriculum files that need to be translated."
|
| 61 |
+
})
|
github_code/freeCodeCamp__freeCodeCamp/.github/workflows/node.js-tests.yml
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CI - Node.js
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- 'main'
|
| 7 |
+
- 'prod-**'
|
| 8 |
+
- 'renovate/**'
|
| 9 |
+
- 'hotfix-**'
|
| 10 |
+
- 'temp-**'
|
| 11 |
+
pull_request:
|
| 12 |
+
branches:
|
| 13 |
+
- 'main'
|
| 14 |
+
- 'temp-**' # Temporary branches allowed on Upstream
|
| 15 |
+
|
| 16 |
+
concurrency:
|
| 17 |
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.workflow_run.head_branch || github.ref }}
|
| 18 |
+
cancel-in-progress: ${{ !contains(github.ref, 'main') && !contains(github.ref, 'prod-') }}
|
| 19 |
+
|
| 20 |
+
permissions:
|
| 21 |
+
contents: read
|
| 22 |
+
|
| 23 |
+
jobs:
|
| 24 |
+
lint:
|
| 25 |
+
name: Lint
|
| 26 |
+
# Skip PR runs for Renovate since push already triggered CI
|
| 27 |
+
if: github.event_name != 'pull_request' || github.event.pull_request.user.login != 'renovate[bot]'
|
| 28 |
+
runs-on: ubuntu-24.04
|
| 29 |
+
strategy:
|
| 30 |
+
matrix:
|
| 31 |
+
node-version: [24]
|
| 32 |
+
fail-fast: false
|
| 33 |
+
|
| 34 |
+
steps:
|
| 35 |
+
- name: Checkout
|
| 36 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 37 |
+
with:
|
| 38 |
+
submodules: 'recursive'
|
| 39 |
+
persist-credentials: false
|
| 40 |
+
|
| 41 |
+
- name: Check number of lockfiles
|
| 42 |
+
run: |
|
| 43 |
+
if [ $(find . -name 'package-lock.json' | grep -vc -e 'node_modules') -gt 0 ]
|
| 44 |
+
then
|
| 45 |
+
echo -e 'Error: found package-lock files in the repository.\nWe use pnpm workspaces to manage packages so all dependencies should be added via pnpm add'
|
| 46 |
+
exit 1
|
| 47 |
+
fi
|
| 48 |
+
|
| 49 |
+
- name: Check format of sample.env
|
| 50 |
+
run: docker run --rm -v `pwd`:/app -w /app dotenvlinter/dotenv-linter check --ignore-checks UnorderedKey sample.env
|
| 51 |
+
|
| 52 |
+
- name: Use Node.js ${{ matrix.node-version }}
|
| 53 |
+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
| 54 |
+
with:
|
| 55 |
+
node-version: ${{ matrix.node-version }}
|
| 56 |
+
|
| 57 |
+
- name: Install pnpm
|
| 58 |
+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
| 59 |
+
id: pnpm-install
|
| 60 |
+
with:
|
| 61 |
+
run_install: false
|
| 62 |
+
|
| 63 |
+
- name: Setup Turbo Cache
|
| 64 |
+
uses: ./.github/actions/setup-turbo-cache
|
| 65 |
+
with:
|
| 66 |
+
turbo-token: ${{ secrets.TURBO_TOKEN }}
|
| 67 |
+
turbo-signature-key: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
|
| 68 |
+
|
| 69 |
+
- name: Set Environment variables
|
| 70 |
+
run: |
|
| 71 |
+
sed '/^[[:space:]]*#/d; /^$/d' sample.env >> $GITHUB_ENV
|
| 72 |
+
|
| 73 |
+
- name: Install node_modules
|
| 74 |
+
run: pnpm install
|
| 75 |
+
|
| 76 |
+
- name: Check formatting
|
| 77 |
+
run: |
|
| 78 |
+
pnpm prettier --check . || [ $? -eq 1 ] && printf "\nTip: Run 'pnpm run format' in your terminal to fix this.\n\n"
|
| 79 |
+
|
| 80 |
+
- name: Lint Source Files
|
| 81 |
+
run: |
|
| 82 |
+
echo pnpm version $(pnpm -v)
|
| 83 |
+
pnpm lint
|
| 84 |
+
|
| 85 |
+
# This is populate the cache, otherwise local runs with upcoming changes
|
| 86 |
+
# will not benefit.
|
| 87 |
+
- name: Set UPCOMING_CHANGES
|
| 88 |
+
run: |
|
| 89 |
+
echo 'SHOW_UPCOMING_CHANGES=true' >> $GITHUB_ENV
|
| 90 |
+
|
| 91 |
+
- name: Lint Upcoming Changes
|
| 92 |
+
run: |
|
| 93 |
+
pnpm lint
|
| 94 |
+
|
| 95 |
+
# DONT REMOVE THIS JOB.
|
| 96 |
+
build:
|
| 97 |
+
name: Build
|
| 98 |
+
runs-on: ubuntu-24.04
|
| 99 |
+
strategy:
|
| 100 |
+
matrix:
|
| 101 |
+
node-version: [24]
|
| 102 |
+
|
| 103 |
+
steps:
|
| 104 |
+
- name: Checkout
|
| 105 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 106 |
+
with:
|
| 107 |
+
submodules: 'recursive'
|
| 108 |
+
persist-credentials: false
|
| 109 |
+
|
| 110 |
+
- name: Use Node.js ${{ matrix.node-version }}
|
| 111 |
+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
| 112 |
+
with:
|
| 113 |
+
node-version: ${{ matrix.node-version }}
|
| 114 |
+
|
| 115 |
+
- name: Install pnpm
|
| 116 |
+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
| 117 |
+
id: pnpm-install
|
| 118 |
+
with:
|
| 119 |
+
run_install: false
|
| 120 |
+
|
| 121 |
+
- name: Setup Turbo Cache
|
| 122 |
+
uses: ./.github/actions/setup-turbo-cache
|
| 123 |
+
with:
|
| 124 |
+
turbo-token: ${{ secrets.TURBO_TOKEN }}
|
| 125 |
+
turbo-signature-key: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
|
| 126 |
+
|
| 127 |
+
- name: Set freeCodeCamp Environment Variables
|
| 128 |
+
run: |
|
| 129 |
+
sed '/^[[:space:]]*#/d; /^$/d' sample.env >> $GITHUB_ENV
|
| 130 |
+
|
| 131 |
+
- name: Install and Build
|
| 132 |
+
run: |
|
| 133 |
+
pnpm install
|
| 134 |
+
pnpm run build
|
| 135 |
+
|
| 136 |
+
- name: Upload Client Artifact
|
| 137 |
+
if: github.event_name == 'pull_request'
|
| 138 |
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
| 139 |
+
with:
|
| 140 |
+
name: client-artifact
|
| 141 |
+
path: client/public
|
| 142 |
+
retention-days: 1
|
| 143 |
+
|
| 144 |
+
build-e2e-api:
|
| 145 |
+
name: Build E2E API (Container)
|
| 146 |
+
if: github.event_name == 'pull_request'
|
| 147 |
+
runs-on: ubuntu-24.04
|
| 148 |
+
|
| 149 |
+
steps:
|
| 150 |
+
- name: Checkout Source Files
|
| 151 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 152 |
+
with:
|
| 153 |
+
persist-credentials: false
|
| 154 |
+
submodules: 'recursive'
|
| 155 |
+
|
| 156 |
+
- name: Create Image
|
| 157 |
+
run: |
|
| 158 |
+
docker build \
|
| 159 |
+
-t fcc-api \
|
| 160 |
+
-f docker/api/Dockerfile .
|
| 161 |
+
|
| 162 |
+
- name: Save Image
|
| 163 |
+
run: docker save fcc-api > api-artifact.tar
|
| 164 |
+
|
| 165 |
+
- name: Upload API Artifact
|
| 166 |
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
| 167 |
+
with:
|
| 168 |
+
name: api-artifact
|
| 169 |
+
path: api-artifact.tar
|
| 170 |
+
retention-days: 1
|
| 171 |
+
|
| 172 |
+
e2e:
|
| 173 |
+
name: E2E
|
| 174 |
+
if: github.event_name == 'pull_request'
|
| 175 |
+
needs: [build, build-e2e-api]
|
| 176 |
+
uses: ./.github/workflows/e2e-playwright.yml
|
| 177 |
+
secrets: inherit
|
| 178 |
+
|
| 179 |
+
test:
|
| 180 |
+
name: Test
|
| 181 |
+
needs: build
|
| 182 |
+
runs-on: ubuntu-24.04
|
| 183 |
+
|
| 184 |
+
strategy:
|
| 185 |
+
fail-fast: false
|
| 186 |
+
matrix:
|
| 187 |
+
node-version: [24]
|
| 188 |
+
|
| 189 |
+
steps:
|
| 190 |
+
- name: Checkout
|
| 191 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 192 |
+
with:
|
| 193 |
+
submodules: 'recursive'
|
| 194 |
+
persist-credentials: false
|
| 195 |
+
|
| 196 |
+
- name: Use Node.js ${{ matrix.node-version }}
|
| 197 |
+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
| 198 |
+
with:
|
| 199 |
+
node-version: ${{ matrix.node-version }}
|
| 200 |
+
|
| 201 |
+
- name: Install pnpm
|
| 202 |
+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
| 203 |
+
id: pnpm-install
|
| 204 |
+
with:
|
| 205 |
+
run_install: false
|
| 206 |
+
|
| 207 |
+
- name: Setup Turbo Cache
|
| 208 |
+
uses: ./.github/actions/setup-turbo-cache
|
| 209 |
+
with:
|
| 210 |
+
turbo-token: ${{ secrets.TURBO_TOKEN }}
|
| 211 |
+
turbo-signature-key: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
|
| 212 |
+
|
| 213 |
+
- name: Set Environment variables
|
| 214 |
+
run: |
|
| 215 |
+
sed '/^[[:space:]]*#/d; /^$/d' sample.env >> $GITHUB_ENV
|
| 216 |
+
cat sample.env
|
| 217 |
+
|
| 218 |
+
- name: Start MongoDB
|
| 219 |
+
run: docker compose -f docker/docker-compose.yml -f docker/docker-compose.ports.yml up -d
|
| 220 |
+
|
| 221 |
+
- name: Install Dependencies
|
| 222 |
+
run: |
|
| 223 |
+
echo pnpm version $(pnpm -v)
|
| 224 |
+
pnpm install
|
| 225 |
+
|
| 226 |
+
- name: Install Chrome for Puppeteer
|
| 227 |
+
run: pnpm -F=curriculum install-puppeteer
|
| 228 |
+
|
| 229 |
+
- name: Run Tests
|
| 230 |
+
run: pnpm test
|
| 231 |
+
|
| 232 |
+
test-upcoming:
|
| 233 |
+
name: Test - Upcoming Changes
|
| 234 |
+
needs: build
|
| 235 |
+
runs-on: ubuntu-24.04
|
| 236 |
+
|
| 237 |
+
strategy:
|
| 238 |
+
fail-fast: false
|
| 239 |
+
matrix:
|
| 240 |
+
node-version: [24]
|
| 241 |
+
|
| 242 |
+
steps:
|
| 243 |
+
- name: Checkout
|
| 244 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 245 |
+
with:
|
| 246 |
+
submodules: 'recursive'
|
| 247 |
+
persist-credentials: false
|
| 248 |
+
|
| 249 |
+
- name: Use Node.js ${{ matrix.node-version }}
|
| 250 |
+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
| 251 |
+
with:
|
| 252 |
+
node-version: ${{ matrix.node-version }}
|
| 253 |
+
|
| 254 |
+
- name: Install pnpm
|
| 255 |
+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
| 256 |
+
id: pnpm-install
|
| 257 |
+
with:
|
| 258 |
+
run_install: false
|
| 259 |
+
|
| 260 |
+
- name: Setup Turbo Cache
|
| 261 |
+
uses: ./.github/actions/setup-turbo-cache
|
| 262 |
+
with:
|
| 263 |
+
turbo-token: ${{ secrets.TURBO_TOKEN }}
|
| 264 |
+
turbo-signature-key: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
|
| 265 |
+
|
| 266 |
+
- name: Set Environment variables
|
| 267 |
+
run: |
|
| 268 |
+
sed '/^[[:space:]]*#/d; /^$/d' sample.env >> $GITHUB_ENV
|
| 269 |
+
echo 'SHOW_UPCOMING_CHANGES=true' >> $GITHUB_ENV
|
| 270 |
+
|
| 271 |
+
- name: Start MongoDB
|
| 272 |
+
run: docker compose -f docker/docker-compose.yml -f docker/docker-compose.ports.yml up -d
|
| 273 |
+
|
| 274 |
+
- name: Install Dependencies
|
| 275 |
+
run: |
|
| 276 |
+
echo pnpm version $(pnpm -v)
|
| 277 |
+
pnpm install
|
| 278 |
+
|
| 279 |
+
- name: Install Chrome for Puppeteer
|
| 280 |
+
run: pnpm -F=curriculum install-puppeteer
|
| 281 |
+
|
| 282 |
+
- name: Run Tests
|
| 283 |
+
run: pnpm test
|
| 284 |
+
|
| 285 |
+
test-localization:
|
| 286 |
+
name: Test - i18n
|
| 287 |
+
needs: build
|
| 288 |
+
runs-on: ubuntu-24.04
|
| 289 |
+
if: github.event.pull_request.user.login == 'camperbot' && github.head_ref == 'chore/update-i18n-curriculum-submodule'
|
| 290 |
+
|
| 291 |
+
strategy:
|
| 292 |
+
fail-fast: false
|
| 293 |
+
matrix:
|
| 294 |
+
node-version: [24]
|
| 295 |
+
locale: [portuguese, italian]
|
| 296 |
+
|
| 297 |
+
steps:
|
| 298 |
+
- name: Checkout
|
| 299 |
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
| 300 |
+
with:
|
| 301 |
+
submodules: 'recursive'
|
| 302 |
+
persist-credentials: false
|
| 303 |
+
|
| 304 |
+
- name: Use Node.js ${{ matrix.node-version }}
|
| 305 |
+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
| 306 |
+
with:
|
| 307 |
+
node-version: ${{ matrix.node-version }}
|
| 308 |
+
|
| 309 |
+
- name: Install pnpm
|
| 310 |
+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
| 311 |
+
id: pnpm-install
|
| 312 |
+
with:
|
| 313 |
+
run_install: false
|
| 314 |
+
|
| 315 |
+
- name: Setup Turbo Cache
|
| 316 |
+
uses: ./.github/actions/setup-turbo-cache
|
| 317 |
+
with:
|
| 318 |
+
turbo-token: ${{ secrets.TURBO_TOKEN }}
|
| 319 |
+
turbo-signature-key: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
|
| 320 |
+
|
| 321 |
+
- name: Set Environment variables
|
| 322 |
+
run: |
|
| 323 |
+
sed '/^[[:space:]]*#/d; /^$/d' sample.env >> $GITHUB_ENV
|
| 324 |
+
cat sample.env
|
| 325 |
+
|
| 326 |
+
- name: Start MongoDB
|
| 327 |
+
uses: supercharge/mongodb-github-action@315db7fe45ac2880b7758f1933e6e5d59afd5e94 # 1.12.1
|
| 328 |
+
with:
|
| 329 |
+
mongodb-version: 8.0
|
| 330 |
+
mongodb-replica-set: test-rs
|
| 331 |
+
mongodb-port: 27017
|
| 332 |
+
|
| 333 |
+
- name: Install Dependencies
|
| 334 |
+
env:
|
| 335 |
+
CURRICULUM_LOCALE: ${{ matrix.locale }}
|
| 336 |
+
CLIENT_LOCALE: ${{ matrix.locale }}
|
| 337 |
+
run: |
|
| 338 |
+
echo pnpm version $(pnpm -v)
|
| 339 |
+
pnpm install
|
| 340 |
+
|
| 341 |
+
# DONT REMOVE THIS STEP.
|
| 342 |
+
# TODO: Refactor and use re-usable workflow and shared artifacts
|
| 343 |
+
- name: Build Client in ${{ matrix.locale }}
|
| 344 |
+
env:
|
| 345 |
+
CURRICULUM_LOCALE: ${{ matrix.locale }}
|
| 346 |
+
CLIENT_LOCALE: ${{ matrix.locale }}
|
| 347 |
+
run: |
|
| 348 |
+
pnpm run build
|
| 349 |
+
|
| 350 |
+
- name: Install Chrome for Puppeteer
|
| 351 |
+
run: pnpm -F=curriculum install-puppeteer
|
| 352 |
+
|
| 353 |
+
- name: Run Tests
|
| 354 |
+
env:
|
| 355 |
+
CURRICULUM_LOCALE: ${{ matrix.locale }}
|
| 356 |
+
CLIENT_LOCALE: ${{ matrix.locale }}
|
| 357 |
+
run: pnpm test
|
github_code/freeCodeCamp__freeCodeCamp/.gitignore
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### VisualStudioCode ###
|
| 2 |
+
.vscode/*
|
| 3 |
+
|
| 4 |
+
### WebStorm ###
|
| 5 |
+
.idea/*
|
| 6 |
+
|
| 7 |
+
### VisualStudioCode Patch ###
|
| 8 |
+
|
| 9 |
+
# Ignore all local history of files
|
| 10 |
+
.history
|
| 11 |
+
|
| 12 |
+
### Windows ###
|
| 13 |
+
|
| 14 |
+
# Windows thumbnail cache files
|
| 15 |
+
Thumbs.db
|
| 16 |
+
Thumbs.db:encryptable
|
| 17 |
+
ehthumbs.db
|
| 18 |
+
ehthumbs_vista.db
|
| 19 |
+
|
| 20 |
+
# Dump file
|
| 21 |
+
*.stackdump
|
| 22 |
+
|
| 23 |
+
# Folder config file
|
| 24 |
+
[Dd]esktop.ini
|
| 25 |
+
|
| 26 |
+
# Recycle Bin used on file shares
|
| 27 |
+
$RECYCLE.BIN/
|
| 28 |
+
|
| 29 |
+
# Windows Installer files
|
| 30 |
+
*.cab
|
| 31 |
+
*.msi
|
| 32 |
+
*.msix
|
| 33 |
+
*.msm
|
| 34 |
+
*.msp
|
| 35 |
+
|
| 36 |
+
# Windows shortcuts
|
| 37 |
+
*.lnk
|
| 38 |
+
|
| 39 |
+
### Linux ###
|
| 40 |
+
|
| 41 |
+
# General
|
| 42 |
+
*~
|
| 43 |
+
|
| 44 |
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
| 45 |
+
.fuse_hidden*
|
| 46 |
+
|
| 47 |
+
# KDE directory preferences
|
| 48 |
+
.directory
|
| 49 |
+
|
| 50 |
+
# Linux trash folder which might appear on any partition or disk
|
| 51 |
+
.Trash-*
|
| 52 |
+
|
| 53 |
+
# .nfs files are created when an open file is removed but is still being accessed
|
| 54 |
+
.nfs*
|
| 55 |
+
|
| 56 |
+
### macOS ###
|
| 57 |
+
|
| 58 |
+
# General
|
| 59 |
+
.DS_Store
|
| 60 |
+
.AppleDouble
|
| 61 |
+
.LSOverride
|
| 62 |
+
|
| 63 |
+
# Icon must end with two \r
|
| 64 |
+
Icon
|
| 65 |
+
|
| 66 |
+
# Thumbnails
|
| 67 |
+
._*
|
| 68 |
+
|
| 69 |
+
# Files that might appear in the root of a volume
|
| 70 |
+
.DocumentRevisions-V100
|
| 71 |
+
.fseventsd
|
| 72 |
+
.Spotlight-V100
|
| 73 |
+
.TemporaryItems
|
| 74 |
+
.Trashes
|
| 75 |
+
.VolumeIcon.icns
|
| 76 |
+
.com.apple.timemachine.donotpresent
|
| 77 |
+
|
| 78 |
+
# Directories potentially created on remote AFP share
|
| 79 |
+
.AppleDB
|
| 80 |
+
.AppleDesktop
|
| 81 |
+
Network Trash Folder
|
| 82 |
+
Temporary Items
|
| 83 |
+
.apdisk
|
| 84 |
+
|
| 85 |
+
### Node ###
|
| 86 |
+
|
| 87 |
+
# Logs
|
| 88 |
+
logs
|
| 89 |
+
*.log
|
| 90 |
+
npm-debug.log*
|
| 91 |
+
yarn-debug.log*
|
| 92 |
+
yarn-error.log*
|
| 93 |
+
|
| 94 |
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
| 95 |
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
| 96 |
+
|
| 97 |
+
# Runtime data
|
| 98 |
+
pids
|
| 99 |
+
*.pid
|
| 100 |
+
*.seed
|
| 101 |
+
*.pid.lock
|
| 102 |
+
|
| 103 |
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
| 104 |
+
lib-cov
|
| 105 |
+
|
| 106 |
+
# Coverage directory used by tools like istanbul
|
| 107 |
+
coverage
|
| 108 |
+
*.lcov
|
| 109 |
+
|
| 110 |
+
# nyc test coverage
|
| 111 |
+
.nyc_output
|
| 112 |
+
|
| 113 |
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
| 114 |
+
.grunt
|
| 115 |
+
|
| 116 |
+
# Bower dependency directory (https://bower.io/)
|
| 117 |
+
bower_components
|
| 118 |
+
|
| 119 |
+
# node-waf configuration
|
| 120 |
+
.lock-wscript
|
| 121 |
+
|
| 122 |
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
| 123 |
+
build/Release
|
| 124 |
+
|
| 125 |
+
# Dependency directories
|
| 126 |
+
node_modules/
|
| 127 |
+
jspm_packages/
|
| 128 |
+
|
| 129 |
+
# Optional npm cache directory
|
| 130 |
+
.npm
|
| 131 |
+
|
| 132 |
+
# Optional eslint cache
|
| 133 |
+
.eslintcache
|
| 134 |
+
|
| 135 |
+
# Optional REPL history
|
| 136 |
+
.node_repl_history
|
| 137 |
+
|
| 138 |
+
# Output of 'npm pack'
|
| 139 |
+
*.tgz
|
| 140 |
+
|
| 141 |
+
# Yarn Integrity file
|
| 142 |
+
.yarn-integrity
|
| 143 |
+
|
| 144 |
+
# dotenv environment variables file
|
| 145 |
+
.env
|
| 146 |
+
.env.test
|
| 147 |
+
|
| 148 |
+
# gatsby files
|
| 149 |
+
.cache/
|
| 150 |
+
|
| 151 |
+
### Netlify ###
|
| 152 |
+
.netlify
|
| 153 |
+
|
| 154 |
+
### Old Generated files ###
|
| 155 |
+
# These files are no longer generated by the client, but can
|
| 156 |
+
# exist on older branches. Continuing to ignore them ensures they
|
| 157 |
+
# are not erroneously committed by contributors (or Naomi) who
|
| 158 |
+
# aren't as familiar with our codebase.
|
| 159 |
+
config/superblock-order.js
|
| 160 |
+
config/superblock-order.test.js
|
| 161 |
+
utils/slugs.js
|
| 162 |
+
utils/slugs.test.js
|
| 163 |
+
|
| 164 |
+
### vim ###
|
| 165 |
+
# Swap
|
| 166 |
+
[._]*.s[a-v][a-z]
|
| 167 |
+
!*.svg # comment out if you don't need vector files
|
| 168 |
+
[._]*.sw[a-p]
|
| 169 |
+
[._]s[a-rt-v][a-z]
|
| 170 |
+
[._]ss[a-gi-z]
|
| 171 |
+
[._]sw[a-p]
|
| 172 |
+
|
| 173 |
+
# Session
|
| 174 |
+
Session.vim
|
| 175 |
+
Sessionx.vim
|
| 176 |
+
|
| 177 |
+
# Temporary
|
| 178 |
+
.netrwhist
|
| 179 |
+
*~
|
| 180 |
+
# Auto-generated tag files
|
| 181 |
+
tags
|
| 182 |
+
# Persistent undo
|
| 183 |
+
[._]*.un~
|
| 184 |
+
|
| 185 |
+
### Additional Files ###
|
| 186 |
+
*.csv
|
| 187 |
+
*.dat
|
| 188 |
+
*.out
|
| 189 |
+
*.gz
|
| 190 |
+
curriculum/curricula.json
|
| 191 |
+
|
| 192 |
+
### Additional Folders ###
|
| 193 |
+
curriculum/dist
|
| 194 |
+
curriculum/build
|
| 195 |
+
curriculum/src/test/blocks-generated
|
| 196 |
+
|
| 197 |
+
### Playwright ###
|
| 198 |
+
|
| 199 |
+
/playwright
|
| 200 |
+
|
| 201 |
+
### Shadow Testing Log Files Folder ###
|
| 202 |
+
api/logs/
|
| 203 |
+
|
| 204 |
+
### Turborepo
|
| 205 |
+
.turbo
|
| 206 |
+
test-results
|
github_code/freeCodeCamp__freeCodeCamp/.gitmodules
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[submodule "curriculum/i18n-curriculum"]
|
| 2 |
+
path = curriculum/i18n-curriculum
|
| 3 |
+
url = https://github.com/freeCodeCamp/i18n-curriculum.git
|
| 4 |
+
ignore = dirty
|
| 5 |
+
[submodule "tools/challenge-editor"]
|
| 6 |
+
path = tools/challenge-editor
|
| 7 |
+
url = https://github.com/freeCodeCamp/challenge-editor.git
|
| 8 |
+
ignore = dirty
|
github_code/freeCodeCamp__freeCodeCamp/.husky/pre-commit
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
NODE_OPTIONS=\"--max-old-space-size=7168\" pnpm lint-staged
|