Skip to content

Commit

Permalink
Merge branch 'solana-foundation:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
flingjie authored Dec 2, 2024
2 parents 081dcad + a7d36ed commit 1ccf2cb
Show file tree
Hide file tree
Showing 291 changed files with 29,163 additions and 18,496 deletions.
4 changes: 2 additions & 2 deletions .github/label-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ solved:
# Close the discussion
close: true
# Set a close reason
close-reason: 'resolved'
close-reason: "resolved"
# Lock the discussion
lock: true
lock: true
18 changes: 11 additions & 7 deletions .github/workflows/contentlayer.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Contentlayer Markdown Formatting

on:
push:
branches: [main]
pull_request:
branches: [main]

Expand All @@ -12,14 +10,20 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm -g i yarn
- run: yarn install
- run: yarn contentlayer:build
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build contentlayer
run: pnpm contentlayer:build
14 changes: 9 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ jobs:
deploy-production:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Vercel CLI and Yarn
run: npm install --global vercel@latest yarn
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Vercel CLI and pnpm
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run:
vercel pull --yes --environment=production
--token=${{secrets.VERCEL_TOKEN }}
- name: Install dependencies via yarn
run: yarn install
- name: Install dependencies via pnpm
run: pnpm install
# todo: if not content files changed, skip uploading
# todo: only upload the changed files
- name: Upload latest content to crowdin
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,28 @@ jobs:
Format:
name: Test formatting via prettier/lint...
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Use Node.js node
uses: actions/setup-node@v2
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
node-version: "18"
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: before_install
run:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
&& sudo sysctl -p

- name: installing yarn
run: yarn install
- name: Install dependencies
run: pnpm install
- name: prettier:check
run: yarn prettier
run: pnpm prettier
- name: lint
run: yarn lint
run: pnpm lint
61 changes: 7 additions & 54 deletions .github/workflows/label-actions.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,16 @@
name: "Label Actions"

# env:
# GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}

on:
pull_request_target:
issues:
types: [labeled, unlabeled]
pull_request:
types: [labeled, unlabeled]
# issues:
# types: [labeled, unlabeled]
# discussion:
# types: [labeled, unlabeled]

permissions:
contents: read
issues: write
pull-requests: write
discussions: write

jobs:
# run the local prettier config on the PR
prettier:
if: contains(github.event.pull_request.labels.*.name, 'prettier')
runs-on: ubuntu-latest

permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Use Node.js node
uses: actions/setup-node@v2
with:
node-version: "18"

- name: before_install
run:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
&& sudo sysctl -p

# perform steps to modify as desired
- name: yarn install
run: yarn install
- name: yarn prettier:fix
run: yarn prettier:fix

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: prettier"

action:
label-actions:
runs-on: ubuntu-latest
steps:
- uses: dessant/label-actions@v4
- uses: dessant/label-actions@v3
with:
# github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
config-path: ".github/label-actions.yml"
github-token: ${{ secrets.GITHUB_TOKEN }}
config-path: .github/label-actions.yml
70 changes: 70 additions & 0 deletions .github/workflows/prettier-label-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Prettier Formatting on Label

# Explicitly set permissions
permissions:
contents: write
pull-requests: write

on:
pull_request:
types: [labeled]

jobs:
prettier-format:
# Only run if the 'prettier' label is added
if: ${{ contains(github.event.pull_request.labels.*.name, 'prettier') }}
runs-on: ubuntu-latest
steps:
# Checkout the PR branch
- uses: actions/checkout@v4
with:
# Use the full PR head reference
ref: ${{ github.event.pull_request.head.ref }}
# Use the full repository name
repository: ${{ github.event.pull_request.head.repo.full_name }}
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

# Setup Node.js (required for Prettier)
- uses: actions/setup-node@v4
with:
node-version: "lts/*"

# Install Prettier
- name: Install Prettier
run: npm install --save-dev --save-exact prettier

# Run Prettier using the repo's config
- name: Run Prettier
run: npx prettier --write .

# Check if there are any changes
- name: Check for changes
id: check-changes
run: |
git diff --quiet || echo "changes=true" >> $GITHUB_OUTPUT
# Commit and push changes if any
- name: Commit changes
if: steps.check-changes.outputs.changes == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "[chore] automatic prettier formatting"
git push origin HEAD:${{ github.event.pull_request.head.ref }}
# Remove the label after formatting
# todo: label removal is flaky, disabled for now
# - name: Remove formatting label
# if: always()
# uses: actions/github-script@v7
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# script: |
# github.rest.issues.removeLabel({
# owner: context.repo.owner,
# repo: context.repo.repo,
# issue_number: context.issue.number,
# name: 'prettier'
# })
37 changes: 37 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Mark Stale Issues and PRs

on:
schedule:
# Run daily at midnight
- cron: "0 0 * * *"

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
# Issues configuration
stale-issue-message:
"This issue has been automatically marked as stale because it has
not had recent activity. Remove stale label or comment or this will
be closed in 5 days."
stale-issue-label: "no-issue-activity"
days-before-issue-stale: 30 # Mark as stale after 30 days of inactivity
days-before-issue-close: 5 # Close 5 days after being marked stale

# Pull Request configuration
stale-pr-message:
"This pull request has been automatically marked as stale because it
has not had recent activity. Remove stale label or comment or this
will be closed in 7 days."
stale-pr-label: "no-pr-activity"
days-before-pr-stale: 21 # Mark PRs as stale after 21 days
days-before-pr-close: 7 # Close PRs 7 days after being marked stale

# Exempt labels and other configurations
exempt-issue-labels: "bug,enhancement,in-progress,not-stale"
exempt-pr-labels: "work-in-progress,review-needed,not-stale"

# Optional: Dry run to test configuration
dry-run: true
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,14 @@ typings/
package-lock.json

# translations are stored in the `i18n` via crowdin
i18n
i18n


# code-import
code/node_modules
code/package-lock.json
code/yarn.lock
code/pnpm-lock.yaml

# vscode configuration
.vscode
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.github/*.md
.github/*.md
CODEOWNERS
5 changes: 3 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# These global owners will be the default owners for everything in
# the repo. Unless a later match takes precedence, will be requested for
# review when someone opens a pull request.
* @nickfrosty
* @ZYJLiu

# This list owns any file in the `/docs` directory in the root of
# the repository and any of its subdirectories.
# /docs/ @nickfrosty

/docs/ @ZYJLiu
Loading

0 comments on commit 1ccf2cb

Please sign in to comment.