Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Okinea Dev authored Jan 6, 2025
2 parents 8a5032b + 42d4960 commit 8202321
Show file tree
Hide file tree
Showing 48 changed files with 1,165 additions and 60 deletions.
20 changes: 20 additions & 0 deletions .github/actions/update-status-label.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

# Only for GitHub Actions
# Parameters: <pr_number> <status> <label>
# Example: ./update-status-label.sh 1234 failure "invalid-colors"

# Exit on error
set -e

pr_number="$1"
status="$2"
label="$3"

action="add-label" && [ "$status" == "success" ] && action="remove-label"

# Add or remove label
gh pr edit "$pr_number" --$action "$label"

[ "$action" == "add-label" ] && echo "✅ Added \"$label\" label to PR #$pr_number"
[ "$action" == "remove-label" ] && echo "✅ Removed \"$label\" label from PR #$pr_number"
10 changes: 5 additions & 5 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Add 'icons' label to any file changes within 'icons' folder or 'src/core/icons' typescript files
icons:
🏞️ icons:
- changed-files:
- any-glob-to-any-file: ['icons/*', 'src/core/icons/*.ts']

# Add 'translations' label to any changes within 'package.nls*.json' files or 'src/core/i18n' folder
translations:
💱 translations:
- changed-files:
- any-glob-to-any-file: ['package.nls*.json', 'src/core/i18n']

# Add 'docs' label to any changes to markdown files
docs:
📝 docs:
- changed-files:
- any-glob-to-any-file: '*.md'

# Add 'workflows' label to any changes within '.github/workflows' folder or '.github/labeler.yml' file
workflows:
🔄 workflows:
- changed-files:
- any-glob-to-any-file: ['.github/workflows/*', '.github/labeler.yml']

# Add 'devcontainers' label to any changes within '.devcontainer' folder
devcontainers:
🐋 devcontainers:
- changed-files:
- any-glob-to-any-file: '.devcontainer/*'
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ on:

permissions:
contents: read
pull-requests: write

jobs:
build:
Expand All @@ -49,6 +50,13 @@ jobs:
run: bun install --frozen-lockfile

- name: 🚀 Test + Build
id: build
run: |
bun test
bun run vscode:prepublish
- name: 🏷️ Manage label based on build result
if: ${{ github.event_name == 'pull_request' }}
run: .github/actions/update-status-label.sh ${{ github.event.pull_request.number }} ${{ steps.build.outcome }} "❌ failed build"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/close-stale-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow closes issues with the labels "info-needed" or "invalid" that have been inactive for 14 days since being marked as stale.
name: ❌ Close inactive issues
on:
schedule:
# It is triggered every day at 1:30 AM UTC.
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
with:
any-of-labels: "❓info-needed,❌ invalid"
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: "⌛ stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
remove-stale-when-updated: true
repo-token: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/color-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

permissions:
contents: read
pull-requests: write

jobs:
color-check:
Expand All @@ -20,12 +21,24 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
.github/actions/update-status-label.sh
material-colors.yml
icons/
- name: 🔄 Fetch target branch
run: |
git fetch origin $TARGET_BRANCH
- name: 🎨 Check colors
id: color-check
run: |
svgFiles=$(git diff origin/$TARGET_BRANCH --diff-filter=ACMRTUX --name-only | grep '.svg$')
npx svg-color-linter --config material-colors.yml ${svgFiles}
- name: 🏷️ Manage label based on color check result
if: always()
run: .github/actions/update-status-label.sh ${{ github.event.pull_request.number }} ${{ steps.color-check.outcome }} "🎨 invalid colors"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .github/workflows/icon-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ jobs:
fetch-depth: 0
path: fork
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
icons/
- name: 📥 Checkout Original
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
path: main
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
.bun-version
icons/
- name: 🔧 Setup Bun
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/potential-duplicates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "🧐 Potential Duplicates"
on:
issues:
types: [opened, edited] # edited means the issue title changed
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/potential-duplicates@4d4ea0352e0383859279938e255179dd1dbb67b5 # v1.1.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Issue title filter work with anymatch https://www.npmjs.com/package/anymatch.
# Any matched issue will stop detection immediately.
# You can specify multi filters in each line.
filter: ''
# Exclude keywords in title before detecting.
exclude: ''
# Label to set, when potential duplicates are detected.
label: "🧐 potential-duplicate"
# Get issues with state to compare. Supported state: 'all', 'closed', 'open'.
state: all
# If similarity is higher than this threshold([0,1]), issue will be marked as duplicate.
threshold: 0.6
# Reactions to be add to comment when potential duplicates are detected.
# Available reactions: "-1", "+1", "confused", "laugh", "heart", "hooray", "rocket", "eyes"
reactions: 'eyes'
# Comment to post when potential duplicates are detected.
comment: |
We have found issues that are potential duplicates: {{#issues}}
- #{{ number }} ({{ accuracy }}%)
{{/issues}}
If any of the issues listed above is a duplicate, please consider closing this issue & upvoting/commenting the original one.
Alternatively, if neither of the listed issues addresses your feature/bug, keep this issue open.
17 changes: 16 additions & 1 deletion .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,38 @@ on:
pull_request:
types: [opened, edited]

permissions:
pull-requests: write

jobs:
lint-pr-title:
name: Check PR Title

runs-on: ubuntu-latest

if: ${{ github.event.action == 'opened' || github.event.changes.title != null }}
steps:
- name: 📥 Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
# Only fetch the config file from the repository
sparse-checkout: commitlint.config.js
sparse-checkout-cone-mode: false
sparse-checkout: |
commitlint.config.js
.github/actions/update-status-label.sh
- name: 📦 Install dependencies
run: npm install --global @commitlint/config-conventional commitlint

- name: 🔍 Check PR title with commitlint
id: title-check
env:
PR_TITLE: ${{ github.event.pull_request.title }}
HELP_URL: https://github.com/material-extensions/vscode-material-icon-theme/blob/main/CONTRIBUTING.md#conventional-pull-request-titles
run: echo "$PR_TITLE" | npx commitlint --help-url $HELP_URL

- name: 🏷️ Manage label based on PR title check result
if: always()
run: .github/actions/update-status-label.sh ${{ github.event.pull_request.number }} ${{ steps.title-check.outcome }} "🔤 invalid title"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Files for vscode extension
!CHANGELOG.md
!LICENSE.md
!LICENSE
!README.md
!logo.png

Expand Down
2 changes: 1 addition & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"attributePosition": "auto"
},
"files": {
"ignore": ["dist", "node_modules", "package.json", "bun.lockb"]
"ignore": ["dist", "node_modules", "package.json", "bun.lock"]
},
"organizeImports": { "enabled": true },
"linter": {
Expand Down
Loading

0 comments on commit 8202321

Please sign in to comment.