Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/sync_upstream_material_icon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: sync_upstream_material_icon
on:
schedule:
- cron: '0 4 * * *'
workflow_dispatch: {}
permissions:
contents: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
sync:
if: github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: npm
- run: npm ci
- id: versions
run: |
current_version=$(node -p "require('./package.json').devDependencies['material-icon-theme']")
latest_version=$(npm view material-icon-theme version)
major_upgrade=$(CURRENT_VERSION="$current_version" LATEST_VERSION="$latest_version" ./node_modules/.bin/tsx -e "import { isMajorVersionUpgrade } from './src/version.ts'; console.log(isMajorVersionUpgrade(process.env.CURRENT_VERSION, process.env.LATEST_VERSION) ? 'true' : 'false')")
echo "current=$current_version" >> "$GITHUB_OUTPUT"
echo "latest=$latest_version" >> "$GITHUB_OUTPUT"
echo "major_upgrade=$major_upgrade" >> "$GITHUB_OUTPUT"
if [ "$current_version" = "$latest_version" ]; then
echo "up_to_date=true" >> "$GITHUB_OUTPUT"
else
echo "up_to_date=false" >> "$GITHUB_OUTPUT"
fi
- if: steps.versions.outputs.up_to_date != 'true' && steps.versions.outputs.major_upgrade != 'true'
run: npm install --save-dev --save-exact material-icon-theme@${{ steps.versions.outputs.latest }}
Comment thread
AHaldner marked this conversation as resolved.
- if: steps.versions.outputs.up_to_date != 'true' && steps.versions.outputs.major_upgrade != 'true'
run: npm run sync
- id: pr-metadata
if: steps.versions.outputs.up_to_date != 'true' && steps.versions.outputs.major_upgrade != 'true'
run: |
{
echo "title=chore: sync material-icon-theme to v${{ steps.versions.outputs.latest }}"
echo "body<<'EOF'"
echo "This PR updates the following dependency:"
echo
echo "| NPM Package | Files Updated | Change |"
echo "| --- | --- | --- |"
echo "| [material-icon-theme](https://www.npmjs.com/package/material-icon-theme) | \`package.json\`, \`package-lock.json\`, \`icon_themes/material-icon-theme.json\`, \`icons/\` | \`${{ steps.versions.outputs.current }}\`... \`${{ steps.versions.outputs.latest }}\` |"
echo
echo "---"
echo
echo "This PR description was generated by \`.github/workflows/sync_upstream_material_icon.yml\`."
echo "EOF"
} >> "$GITHUB_OUTPUT"
- id: create-pr
if: steps.versions.outputs.up_to_date != 'true' && steps.versions.outputs.major_upgrade != 'true'
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
add-paths: |
package.json
package-lock.json
icon_themes/material-icon-theme.json
icons
branch: automation/material-icon-sync
base: main
commit-message: ${{ steps.pr-metadata.outputs.title }}
title: ${{ steps.pr-metadata.outputs.title }}
body: ${{ steps.pr-metadata.outputs.body }}
delete-branch: false
- if: steps.versions.outputs.up_to_date == 'true'
run: echo "material-icon-theme is already current at ${{ steps.versions.outputs.current }}"
- if: steps.versions.outputs.major_upgrade == 'true'
run: echo "Skipping automated material-icon-theme PR because ${{ steps.versions.outputs.current }} to ${{ steps.versions.outputs.latest }} is a major version upgrade"
defaults:
run:
shell: bash -euxo pipefail {0}
Loading