Skip to content

Sync from Pulsar

Sync from Pulsar #3809

Workflow file for this run

name: Sync from Pulsar
on:
schedule:
- cron: 0 * * * *
workflow_dispatch:
concurrency:
group: from-pulsar
cancel-in-progress: true
jobs:
sync:
runs-on: ubuntu-22.04
steps:
- name: checkout repo
uses: actions/[email protected]
with:
path: sync
- name: checkout pulsar
uses: actions/[email protected]
with:
repository: pulsar-edit/pulsar
# TODO change this back to master when the PR is merged
ref: i18n
path: pulsar
- name: check if pulsar received a commit since last run
id: check
run: |
node sync/script/has-new-commit.mjs >> $GITHUB_OUTPUT
- name: update sync repo with new sources
if: ${{ steps.check.outputs.has-new == 'true' }}
run: |
rm -rf sync/cson
mkdir -p sync/cson
cp -R pulsar/i18n sync/cson/core
packages=(
"about"
"archive-view"
"atom-dark-syntax"
"atom-dark-ui"
"atom-light-syntax"
"atom-light-ui"
"autocomplete-atom-api"
"autocomplete-css"
"autocomplete-html"
"autocomplete-plus"
"autocomplete-snippets"
"autoflow"
"autosave"
"background-tips"
"base16-tomorrow-dark-theme"
"base16-tomorrow-light-theme"
"bookmarks"
"bracket-matcher"
"command-palette"
"dalek"
"deprecation-cop"
"dev-live-reload"
"encoding-selector"
"exception-reporting"
"find-and-replace"
"fuzzy-finder"
"git-diff"
"go-to-line"
"grammar-selector"
"image-view"
"incompatible-packages"
"keybinding-resolver"
"language-c"
"language-clojure"
"language-coffee-script"
"language-csharp"
"language-css"
"language-gfm"
"language-git"
"language-go"
"language-html"
"language-hyperlink"
"language-java"
"language-javascript"
"language-json"
"language-less"
"language-make"
"language-mustache"
"language-objective-c"
"language-perl"
"language-php"
"language-property-list"
"language-python"
"language-ruby"
"language-ruby-on-rails"
"language-rust-bundled"
"language-sass"
"language-shellscript"
"language-source"
"language-sql"
"language-text"
"language-todo"
"language-toml"
"language-typescript"
"language-xml"
"language-yaml"
"line-ending-selector"
"link"
"markdown-preview"
"notifications"
"one-dark-syntax"
"one-dark-ui"
"one-light-syntax"
"one-light-ui"
"open-on-github"
"package-generator"
"settings-view"
"solarized-dark-syntax"
"solarized-light-syntax"
"spell-check"
"status-bar"
"styleguide"
"tabs"
"timecop"
"tree-view"
"update-package-dependencies"
"welcome"
"whitespace"
"wrap-guide"
)
mkdir -p sync/cson/packages
for package in "${packages[@]}"; do
if [ -d "pulsar/packages/$package/i18n" ]; then
cp -R "pulsar/packages/$package/i18n" "sync/cson/packages/$package"
fi
done
- name: check if should continue
if: ${{ steps.check.outputs.has-new == 'true' }}
id: should-continue
working-directory: sync
run: |
if [ -z "$(git status --porcelain=v1 2>/dev/null)" ]; then
echo "should-continue=false" >> $GITHUB_OUTPUT
else
echo "should-continue=true" >> $GITHUB_OUTPUT
fi
- name: setup pnpm (yes)
if: ${{ steps.check.outputs.has-new == 'true' && steps.should-continue.outputs.should-continue == 'true' }}
uses: pnpm/[email protected]
with:
version: "8.5.1"
- name: update and commit JSON from new CSON
if: ${{ steps.check.outputs.has-new == 'true' && steps.should-continue.outputs.should-continue == 'true' }}
working-directory: sync
run: |
pnpm i
rm -rf json
node script/update-json.mjs
git config --global user.name smol
git config --global user.email [email protected]
echo "https://meadowsys:${{ secrets.GITHUB_TOKEN }}@github.com" > .git/credentials
git config --global credential.helper "store --file=.git/credentials"
git config --unset-all http.https://github.com/.extraheader # https://stackoverflow.com/a/69979203
git add -A
git commit -m "(automated) updating JSON files from pulsar-edit/pulsar@${{ steps.check.outputs.pulsar-commit }}"
git push