Skip to content

Commit

Permalink
Merge branch 'main' into marleens_comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jpelay committed Nov 8, 2024
2 parents 1ac7236 + 6e7f8fb commit c3da61d
Show file tree
Hide file tree
Showing 676 changed files with 50,436 additions and 432,354 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/deploy-to-alpha-manually.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Manually deploy to Alpha
on:
workflow_dispatch: {}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: akhileshns/[email protected] # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: hedy-alpha
heroku_email: [email protected]
1 change: 1 addition & 0 deletions .github/workflows/deploy-to-alpha.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Automatically deploy to Alpha
on:

# Run this AFTER the unit test job finishes
workflow_run:
# Must be the same as in unittests.yml, cypresstests.yml
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,7 @@ file_logger.json
# We submitted a PR to the package, but it's still wating to be approved
# Until then, we can include it in .gitignore
# More info in #4540
foo.txt
foo.txt

# Generated schema json files
*.generated.schema.json
7 changes: 6 additions & 1 deletion .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ queue_rules:
commit_message_template: |-
{{ title }} (#{{number}})
{{ body }}
{# Add co-author information at the end of the squash merge commit message #}
{% for co_author in co_authors | unique -%}
Co-Authored-By: {{ co_author.name }} <{{ co_author.email }}>
{% endfor -%}
{# `Co-Authored-By` lines must the be last ones for GitHub to recognize them #}
pull_request_rules:
- name: Automatic squash merge on approval
Expand All @@ -21,4 +26,4 @@ pull_request_rules:
comment:
message: Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to [allow changes to be pushed to your fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork)).
queue:
name: default_queue
name: default_queue
10 changes: 7 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
from flask import (Flask, Response, abort, after_this_request, g, jsonify, make_response,
redirect, request, send_file, url_for,
send_from_directory, session)
from flask_babel import Babel, gettext
from flask_babel import Babel
from website.flask_helpers import gettext_with_fallback as gettext
from website.flask_commonmark import Commonmark
from flask_compress import Compress
from urllib.parse import quote_plus
Expand Down Expand Up @@ -443,6 +444,10 @@ def before_request_https():
Compress(app)
Commonmark(app)

# Explicitly substitute the flask gettext function with our custom definition which uses fallback languages
app.jinja_env.globals.update(_=gettext)


# We don't need to log in offline mode
if utils.is_offline_mode():
parse_logger = s3_logger.NullLogger()
Expand Down Expand Up @@ -1960,7 +1965,7 @@ def view_program(user, id):
level=int(result['level']),
code=code),
is_teacher=user['is_teacher'],
class_id=student_customizations['id'],
class_id=student_customizations.get('id'),
next_program_id=next_program_id,
next_classmate_program_id=next_classmate_adventure_id,
**arguments_dict)
Expand Down Expand Up @@ -2313,7 +2318,6 @@ def favicon():
@app.route('/index.html')
def main_page():
sections = hedyweb.PageTranslations('start').get_page_translations(g.lang)['home-sections']

sections = sections[:]

# Sections have 'title', 'text'
Expand Down
18 changes: 14 additions & 4 deletions build-tools/github/validate-yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,26 @@ echo "------> Validating YAML"
# 'npx pajv validate' just hangs. Running the 'pajv' binary directly without the use of
# 'npx' does work... so we're just going to ¯\_(ツ)_/¯ and do that.

all_schemas=$(find content -name \*.schema.json)
schemas=$(find content -name \*.schema.json)

failures=false

for schema in $all_schemas; do
for schema in $schemas; do
dir=$(dirname $schema)
echo "------> Validating $(basename $dir)"

# The non-generated schema files that have required fields. They should be
# used for 'en.yaml' files. The generated schema files allow all fields to be
# optional, so they should be used to validate the rest of the yaml files.
if [[ $schema == *".generated."* ]]; then
files="*";
echo "------> Validating with optional fields $(basename $dir)/*.yaml"
else
files="en";
echo "------> Validating with required fields $(basename $dir)/en.yaml"
fi

# Run the validator.
if ! check-jsonschema -o text --schemafile $schema $dir/*.yaml > validate.txt; then
if ! check-jsonschema -o text --schemafile $schema $dir/$files.yaml > validate.txt; then
cat validate.txt || true
failures=true
fi
Expand Down
9 changes: 1 addition & 8 deletions content/adventures/adventures.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@
"type": "object",
"additionalProperties": false,
"properties": {
"title": {
"type": "string",
"description": "Short title of the adventure"
},
"subtitle": {
"type": "string",
"description": "Slightly longer introductory description of the adventure"
},
"adventures": {
"type": "object",
"description": "Individual adventures, key/value map",
"additionalProperties": { "$ref": "#/definitions/Adventure" }
}
},
"required": ["adventures"],
"definitions": {
"Adventure": {
"type": "object",
Expand Down
Loading

0 comments on commit c3da61d

Please sign in to comment.