# This workflow is designed to stop us accidently committing the lockfile/packagejson symlink changes # which would cause the default Ember version to change. name: Ember Version Enforcement on: pull_request: push: branches: - main permissions: contents: write jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 with: node-version: 20 cache: yarn - name: Yarn install run: | cd app/assets/javascripts/discourse yarn install - name: "Check default ember version" working-directory: app/assets/javascripts/discourse run: | node -e ' const version = require("ember-source/package.json").version; console.log("Ember version is", version); if(version.split(".")[0] !== "5"){ console.log(`Ember has unexpectedly been downgraded to version ${version}. If this is intentional, remove this github workflow.`); process.exit(1); } ' - name: Downgrade ember run: | script/switch_ember_version 3 cd app/assets/javascripts/discourse yarn install - name: "Check upgraded version" working-directory: app/assets/javascripts/discourse run: | node -e ' const version = require("ember-source/package.json").version; console.log("Ember version is", version); if(version.split(".")[0] !== "3"){ console.log(`Expected Ember 3, but found ${version}`); process.exit(1); } ' - name: "Revert ember downgrade" run: | script/switch_ember_version 5 - name: "Ensure no diff" run: | if [ ! -z "$(git status --porcelain)" ]; then echo "Working directory was not clean after upgrading/downgrading ember. Perhaps a lockfile is out-of-date. Run this command to re-sync:" echo " script/regen_ember_3_lockfile" echo echo "Current diff:" echo "---------------------------------------------" git -c color.ui=always diff exit 1 fi