mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-02 13:04:18 -07:00
Add intl pre-commit hook and update GHA (#1416)
* Add intl pre-commit hook and update GHA - add Husky lib - add pre-commit script - detect warning on extraction and abort commit - update deploy staging yml to show message that en.json was modified * Test if block of message post - test if the message is posted even when checking a file with no changes * Add back in full deploy action * Add back en.json
This commit is contained in:
parent
31d783bd1b
commit
14ad8c2ee4
8 changed files with 787 additions and 185 deletions
13
.github/workflows/deploy_fe_staging.yml
vendored
13
.github/workflows/deploy_fe_staging.yml
vendored
|
@ -95,3 +95,16 @@ jobs:
|
||||||
- name: Printing deployment URLs
|
- name: Printing deployment URLs
|
||||||
run: |
|
run: |
|
||||||
echo "Github pages: https://usds.github.io/justice40-tool/$DESTINATION_FOLDER/en"
|
echo "Github pages: https://usds.github.io/justice40-tool/$DESTINATION_FOLDER/en"
|
||||||
|
- name: Get changed files using defaults
|
||||||
|
id: changed-files
|
||||||
|
uses: tj-actions/changed-files@v18.1
|
||||||
|
- name: Update PR with message that en.json has been updated
|
||||||
|
uses: mshick/add-pr-comment@v1
|
||||||
|
with:
|
||||||
|
message: |
|
||||||
|
** 👋 Attention translators!! 👋 **
|
||||||
|
Copy changes have resulted in a new en.json file. Please translate all other language files.
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
repo-token-user-login: "github-actions[bot]" # The user.login for temporary GitHub tokens
|
||||||
|
allow-repeats: false # This is the default
|
||||||
|
if: contains(steps.changed-files.outputs.modified_files, 'client/src/intl/en.json')
|
||||||
|
|
41
client/.husky/pre-commit
Executable file
41
client/.husky/pre-commit
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "[pre-commit hook msg]: running pre-commit hook ..."
|
||||||
|
|
||||||
|
# Husky by default expects pre-commit hooks in the root directory. We set up a custom directory for the client folder
|
||||||
|
# https://typicode.github.io/husky/#/?id=custom-directory
|
||||||
|
cd client
|
||||||
|
|
||||||
|
# This file will automatically run intl:extract and compile on every commit
|
||||||
|
# write the extracted errors into a file
|
||||||
|
npm run intl:extract 2> extract-err.txt
|
||||||
|
|
||||||
|
# check the extracted error files for warnings and abort commit if found
|
||||||
|
if grep -F "warning" extract-err.txt
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo '[pre-commit hook msg]: ALERT: warnings found in extraction process. Please remove warnings and re-run "npm run intl:extract"'
|
||||||
|
echo
|
||||||
|
echo '[pre-commit hook msg]: aborting commit...'
|
||||||
|
echo
|
||||||
|
echo '[pre-commit hook msg]: removing extract-err file...'
|
||||||
|
echo
|
||||||
|
rm extract-err.txt
|
||||||
|
echo '[pre-commit hook msg]: pre-commit hook incomplete.'
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo '[pre-commit hook msg]: no warnings found, continuing with commit ...'
|
||||||
|
echo
|
||||||
|
echo '[pre-commit hook msg]: removing extract-err file ...'
|
||||||
|
echo
|
||||||
|
rm extract-err.txt
|
||||||
|
echo '[pre-commit hook msg]: adding en.json to staging area ...'
|
||||||
|
echo
|
||||||
|
# add the en.json to staging so that the pre-commit hook can include it in the commit
|
||||||
|
git add src/intl/en.json
|
||||||
|
echo '[pre-commit hook msg]: pre-commit hook complete.'
|
||||||
|
echo
|
||||||
|
fi
|
6
client/package-lock.json
generated
6
client/package-lock.json
generated
|
@ -12515,6 +12515,12 @@
|
||||||
"integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==",
|
"integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"husky": {
|
||||||
|
"version": "7.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz",
|
||||||
|
"integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"hyphenate-style-name": {
|
"hyphenate-style-name": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz",
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
"lint:fix": "npm run lint -- --quiet --fix",
|
"lint:fix": "npm run lint -- --quiet --fix",
|
||||||
"intl:extract": "formatjs extract 'src/**/*.tsx' --out-file src/intl/en.json",
|
"intl:extract": "formatjs extract 'src/**/*.tsx' --out-file src/intl/en.json",
|
||||||
"intl:compile-en": "formatjs compile src/intl/en.json --ast --out-file compiled-lang/en.json",
|
"intl:compile-en": "formatjs compile src/intl/en.json --ast --out-file compiled-lang/en.json",
|
||||||
"test:intl-extraction": "node src/intl/testIntlExtraction"
|
"test:intl-extraction": "node src/intl/testIntlExtraction",
|
||||||
|
"prepare": "cd .. && husky install client/.husky"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@formatjs/cli": "^4.2.15",
|
"@formatjs/cli": "^4.2.15",
|
||||||
|
@ -61,6 +62,7 @@
|
||||||
"gatsby-plugin-react-helmet": "^4.6.0",
|
"gatsby-plugin-react-helmet": "^4.6.0",
|
||||||
"gatsby-plugin-sass": "^4.5.0",
|
"gatsby-plugin-sass": "^4.5.0",
|
||||||
"gh-pages": "^3.2.0",
|
"gh-pages": "^3.2.0",
|
||||||
|
"husky": "^7.0.4",
|
||||||
"identity-obj-proxy": "^3.0.0",
|
"identity-obj-proxy": "^3.0.0",
|
||||||
"jest": "^27.0.1",
|
"jest": "^27.0.1",
|
||||||
"license-checker": "^25.0.1",
|
"license-checker": "^25.0.1",
|
||||||
|
|
|
@ -58,7 +58,7 @@ export const CENSUS_TRACT_FEEDBACK = {
|
||||||
description={'census tract feedback section'}
|
description={'census tract feedback section'}
|
||||||
/>,
|
/>,
|
||||||
PARAGRAPH3: <FormattedMessage
|
PARAGRAPH3: <FormattedMessage
|
||||||
id={'contact.page.census.tract.feedback.para1'}
|
id={'contact.page.census.tract.feedback.para3'}
|
||||||
defaultMessage={`
|
defaultMessage={`
|
||||||
In addition, you can provide feedback on the tool via this {improvementSurvey}.
|
In addition, you can provide feedback on the tool via this {improvementSurvey}.
|
||||||
`}
|
`}
|
||||||
|
|
|
@ -523,7 +523,7 @@ export const SIDE_PANEL_INDICATOR_DESCRIPTION = defineMessages({
|
||||||
description: 'Proposed or listed NPL (Superfund) sites within 5 kilometers',
|
description: 'Proposed or listed NPL (Superfund) sites within 5 kilometers',
|
||||||
},
|
},
|
||||||
PROX_RMP: {
|
PROX_RMP: {
|
||||||
id: 'areaDetail.indicator.description.prox.npl',
|
id: 'areaDetail.indicator.description.prox.rmp',
|
||||||
defaultMessage: 'Risk Management Plan facilities within 5 kilometers',
|
defaultMessage: 'Risk Management Plan facilities within 5 kilometers',
|
||||||
description: 'Risk Management Plan facilities within 5 kilometers',
|
description: 'Risk Management Plan facilities within 5 kilometers',
|
||||||
},
|
},
|
||||||
|
|
|
@ -72,9 +72,9 @@ export const FORMULA = {
|
||||||
}}
|
}}
|
||||||
/>,
|
/>,
|
||||||
THEN: <FormattedMessage
|
THEN: <FormattedMessage
|
||||||
id={'methodology.page.formula.second'}
|
id={'methodology.page.formula.third'}
|
||||||
defaultMessage={ `{then} the community is considered disadvantaged.`}
|
defaultMessage={ `{then} the community is considered disadvantaged.`}
|
||||||
description={'the second part of the formula used in the methodology'}
|
description={'the third part of the formula used in the methodology'}
|
||||||
values= {{
|
values= {{
|
||||||
then: <span>THEN</span>,
|
then: <span>THEN</span>,
|
||||||
}}
|
}}
|
||||||
|
@ -243,7 +243,7 @@ export const CATEGORIES = {
|
||||||
},
|
},
|
||||||
CLEAN_ENERGY: {
|
CLEAN_ENERGY: {
|
||||||
METHODOLOGY: <FormattedMessage
|
METHODOLOGY: <FormattedMessage
|
||||||
id= {'indicator.categories.climate.change.methodology'}
|
id= {'indicator.categories.clean.energy.methodology'}
|
||||||
defaultMessage= {`Clean energy and energy efficiency category`}
|
defaultMessage= {`Clean energy and energy efficiency category`}
|
||||||
description= {`Clean energy and energy efficiency methodology`}
|
description= {`Clean energy and energy efficiency methodology`}
|
||||||
/>,
|
/>,
|
||||||
|
@ -573,7 +573,7 @@ export const RESPONSIBLE_PARTIES = {
|
||||||
|
|
||||||
export const SOURCE_LINKS = {
|
export const SOURCE_LINKS = {
|
||||||
CENSUS_ACS_15_19: <FormattedMessage
|
CENSUS_ACS_15_19: <FormattedMessage
|
||||||
id= {'category.source.census.link'}
|
id= {'category.source.census.link.15'}
|
||||||
defaultMessage= {'{sourceCensusLink} from {date15_19}'}
|
defaultMessage= {'{sourceCensusLink} from {date15_19}'}
|
||||||
description= {'source link for Census ACS'}
|
description= {'source link for Census ACS'}
|
||||||
values= {{
|
values= {{
|
||||||
|
@ -588,7 +588,7 @@ export const SOURCE_LINKS = {
|
||||||
}}
|
}}
|
||||||
/>,
|
/>,
|
||||||
CENSUS_ACS_10: <FormattedMessage
|
CENSUS_ACS_10: <FormattedMessage
|
||||||
id= {'category.source.census.link'}
|
id= {'category.source.census.link.10'}
|
||||||
defaultMessage= {'{sourceCensusLink} from {date10}'}
|
defaultMessage= {'{sourceCensusLink} from {date10}'}
|
||||||
description= {'source link for Census ACS'}
|
description= {'source link for Census ACS'}
|
||||||
values= {{
|
values= {{
|
||||||
|
@ -1047,7 +1047,7 @@ export const INDICATORS = [
|
||||||
domID: 'median-home',
|
domID: 'median-home',
|
||||||
indicator: 'Median home value',
|
indicator: 'Median home value',
|
||||||
description: <FormattedMessage
|
description: <FormattedMessage
|
||||||
id= {'category.lead.paint.description.text'}
|
id= {'category.median.home.value.description.text'}
|
||||||
defaultMessage= {`
|
defaultMessage= {`
|
||||||
Median home value of owner-occupied housing units in the census tract.
|
Median home value of owner-occupied housing units in the census tract.
|
||||||
`}
|
`}
|
||||||
|
@ -1189,13 +1189,13 @@ export const INDICATORS = [
|
||||||
domID: 'heart-disease',
|
domID: 'heart-disease',
|
||||||
indicator: 'Heart disease',
|
indicator: 'Heart disease',
|
||||||
description: <FormattedMessage
|
description: <FormattedMessage
|
||||||
id= {'category.diabetes.description.text'}
|
id= {'category.heart.disease.description.text'}
|
||||||
defaultMessage= {`
|
defaultMessage= {`
|
||||||
Weighted percent of people ages 18 years and older who report ever having been told
|
Weighted percent of people ages 18 years and older who report ever having been told
|
||||||
by a doctor, nurse, or other health professionals that they had angina or
|
by a doctor, nurse, or other health professionals that they had angina or
|
||||||
coronary heart disease.
|
coronary heart disease.
|
||||||
`}
|
`}
|
||||||
description= {'description text for diabetes'}
|
description= {'description text for heart disease'}
|
||||||
/>,
|
/>,
|
||||||
usedIn: CATEGORIES.HEALTH_BURDENS.METHODOLOGY,
|
usedIn: CATEGORIES.HEALTH_BURDENS.METHODOLOGY,
|
||||||
responsibleParty: RESPONSIBLE_PARTIES.CDC,
|
responsibleParty: RESPONSIBLE_PARTIES.CDC,
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue