Issue#2 adding an attribute to post data and creating dropdown #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Homework 1 Check | |
on: | |
pull_request: | |
branches: | |
- main | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
jobs: | |
hw1: | |
permissions: | |
checks: write | |
contents: read | |
name: Homework 1 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
node: [16] | |
runs-on: ${{ matrix.os }} | |
env: | |
TEST_ENV: ${{ matrix.test_env || 'production' }} | |
services: | |
mongo: | |
image: 'mongo:3.7' | |
ports: | |
# Maps port 27017 on service container to the host | |
- 27017:27017 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: cp install/package.json package.json | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: NPM Install | |
uses: bahmutov/npm-install@v1 | |
with: | |
useLockFile: false | |
- name: Setup on MongoDB | |
env: | |
SETUP: >- | |
{ | |
"url": "http://127.0.0.1:4567", | |
"secret": "abcdef", | |
"admin:username": "admin", | |
"admin:email": "test@example.org", | |
"admin:password": "hAN3Eg8W", | |
"admin:password:confirm": "hAN3Eg8W", | |
"database": "mongo", | |
"mongo:host": "127.0.0.1", | |
"mongo:port": 27017, | |
"mongo:username": "", | |
"mongo:password": "", | |
"mongo:database": "nodebb" | |
} | |
CI: >- | |
{ | |
"host": "127.0.0.1", | |
"port": 27017, | |
"database": "ci_test" | |
} | |
run: | | |
node app --setup="${SETUP}" --ci="${CI}" | |
- name: Get specific changed files | |
id: changed-files-specific | |
uses: tj-actions/changed-files@v24 | |
with: | |
files: | | |
./**/*.js | |
./**/*.ts | |
- name: Check that HW1 specifications are met | |
run: | | |
IFS=' ' read -r -a addedarray <<< "${{ steps.changed-files-specific.outputs.added_files }}" | |
IFS=' ' read -r -a modifiedarray <<< "${{ steps.changed-files-specific.outputs.modified_files }}" | |
PASS="false" | |
for addedfile in "${addedarray[@]}" | |
do | |
IFS='. ' read -r -a addfilesplit <<< $addedfile | |
ADDFILENAME="${addfilesplit[0]}" | |
ADDFILEEXT="${addfilesplit[1]}" | |
if [ "$ADDFILEEXT" == "ts" ] | |
then | |
for modifiedfile in "${modifiedarray[@]}" | |
do | |
IFS='. ' read -r -a modfilesplit <<< $modifiedfile | |
MODFILENAME="${modfilesplit[0]}" | |
MODFILEEXT="${modfilesplit[1]}" | |
if [ "$MODFILEEXT" == "js" ] && [ "$ADDFILENAME" == "$MODFILENAME" ] | |
then | |
echo "Found suitable file!" | |
PASS="true" | |
fi | |
done | |
fi | |
done | |
if [ "$PASS" != "true" ] | |
then | |
echo "No suitable files found that match the requirements of HW1. Please check that you have translated a JS file into TypeScript and regenerated the JavaScript file using % npx tsc" | |
echo "Files added (should see your xx.ts file): ${{ steps.changed-files-specific.outputs.added_files }}" | |
echo "Files modified (should see your xx.js file): ${{ steps.changed-files-specific.outputs.modified_files }}" | |
exit 1 | |
fi |