From 05ce482135688229ac54df4eb4de1459a2e913f0 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Thu, 16 Dec 2021 14:13:39 -0800 Subject: [PATCH 1/2] Use uppercase for constant variable names. --- js/CompletionCriteria.js | 10 ++++---- js/package.json | 2 +- le_utils/constants/completion_criteria.py | 30 +++++++++++------------ scripts/generate_from_specs.py | 2 +- setup.py | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/js/CompletionCriteria.js b/js/CompletionCriteria.js index 3191897..9d32276 100644 --- a/js/CompletionCriteria.js +++ b/js/CompletionCriteria.js @@ -3,9 +3,9 @@ // CompletionCriteria export default { - approx_time: "approx_time", - mastery: "mastery", - pages: "pages", - reference: "reference", - time: "time", + APPROX_TIME: "approx_time", + MASTERY: "mastery", + PAGES: "pages", + REFERENCE: "reference", + TIME: "time", }; diff --git a/js/package.json b/js/package.json index 5561e11..d0a6b8a 100644 --- a/js/package.json +++ b/js/package.json @@ -27,5 +27,5 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "version": "0.1.35" + "version": "0.1.36" } diff --git a/le_utils/constants/completion_criteria.py b/le_utils/constants/completion_criteria.py index 9094d3a..f8ce30c 100644 --- a/le_utils/constants/completion_criteria.py +++ b/le_utils/constants/completion_criteria.py @@ -4,24 +4,24 @@ # CompletionCriteria -approx_time = "approx_time" -mastery = "mastery" -pages = "pages" -reference = "reference" -time = "time" +APPROX_TIME = "approx_time" +MASTERY = "mastery" +PAGES = "pages" +REFERENCE = "reference" +TIME = "time" choices = ( - (approx_time, "Approx Time"), - (mastery, "Mastery"), - (pages, "Pages"), - (reference, "Reference"), - (time, "Time"), + (APPROX_TIME, "Approx Time"), + (MASTERY, "Mastery"), + (PAGES, "Pages"), + (REFERENCE, "Reference"), + (TIME, "Time"), ) COMPLETIONCRITERIALIST = [ - approx_time, - mastery, - pages, - reference, - time, + APPROX_TIME, + MASTERY, + PAGES, + REFERENCE, + TIME, ] diff --git a/scripts/generate_from_specs.py b/scripts/generate_from_specs.py index 6a143ad..3ccaa39 100644 --- a/scripts/generate_from_specs.py +++ b/scripts/generate_from_specs.py @@ -151,7 +151,7 @@ def read_constants_specs(): constants_spec = json.load(json_constants_spec_file) key = snake_to_pascal(constants_spec_file.split("-")[-1].split(".")[0]) constants_outputs[key] = OrderedDict( - [(a, a) for a in sorted(constants_spec)] + [(a.upper(), a) for a in sorted(constants_spec)] ) return constants_outputs diff --git a/setup.py b/setup.py index ce32b8f..54a28c0 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name="le-utils", packages=find_packages(), - version="0.1.35", + version="0.1.36", description="LE-Utils contains shared constants used in Kolibri, Ricecooker, and Kolibri Studio.", long_description=long_description, long_description_content_type="text/markdown", From 31d2bd6f0bd160147b0622c14222b919329fafd3 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Thu, 16 Dec 2021 14:19:57 -0800 Subject: [PATCH 2/2] Try to make spec finalization job work. --- .github/workflows/finalized_specs.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/finalized_specs.yml b/.github/workflows/finalized_specs.yml index a626557..4b65aae 100644 --- a/.github/workflows/finalized_specs.yml +++ b/.github/workflows/finalized_specs.yml @@ -4,21 +4,24 @@ on: [push, pull_request] jobs: change_check: - name: Path match check + name: Check if file changed runs-on: ubuntu-latest # Map a step output to a job output outputs: - not_modified: ${{ steps.skip_check.outputs.should_skip }} + modified: ${{ steps.changes.outputs.modified }} steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master + - name: Checkout repository + uses: actions/checkout@v2 with: - github_token: ${{ github.token }} - paths: '["spec/labels-v1.json"]' + fetch-depth: 0 + - id: changes + # Set outputs using the command. + run: | + echo "::set-output name=modified::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep spec/labels-v1.json$ | xargs)" unit_test: name: Error if finalized spec modified needs: change_check - if: ${{ needs.change_check.outputs.not_modified != 'true' }} + if: ${{ needs.change_check.outputs.modified }} runs-on: ubuntu-18.04 steps: - name: Fail if specs modified