From d623908342670a96415caf5eabcccc020886c004 Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Wed, 4 Sep 2024 11:46:21 -0400 Subject: [PATCH 01/10] PXBF-dev: Add workflow for updating hash --- .github/workflows/increment_sub_hash.yml | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/increment_sub_hash.yml diff --git a/.github/workflows/increment_sub_hash.yml b/.github/workflows/increment_sub_hash.yml new file mode 100644 index 000000000..519737a53 --- /dev/null +++ b/.github/workflows/increment_sub_hash.yml @@ -0,0 +1,27 @@ +name: Update Submodule Hash + +on: + workflow_dispatch: # Allows manual trigger + +jobs: + update-submodule: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository with submodules + uses: actions/checkout@v4 + with: + submodules: true # Checkout the submodule + + - name: Fetch latest commit in the submodule + run: | + cd usagov-2021/ + git fetch origin # Fetch the latest changes + git checkout origin/main # Checkout the latest commit from submodule (replace 'main' with the submodule's branch) + + - name: Push submodule update + run: | + cd usagov-2021/ + git push origin HEAD:main # Push the new commit of the submodule + env: + GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }} # Use GitHub token for authentication From a28c7cdb13c70d8f6dfa406a0b9272c947a39941 Mon Sep 17 00:00:00 2001 From: scottqueen-bixal Date: Thu, 5 Sep 2024 10:43:44 -0400 Subject: [PATCH 02/10] PXBF-1772-bug-fix-requried-field-error: ensure the node is not required before handling to error state --- .../src/shared/utils/errorHandling/index.js | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/benefit-finder/src/shared/utils/errorHandling/index.js b/benefit-finder/src/shared/utils/errorHandling/index.js index f9c27b25e..a41636aa5 100644 --- a/benefit-finder/src/shared/utils/errorHandling/index.js +++ b/benefit-finder/src/shared/utils/errorHandling/index.js @@ -28,36 +28,40 @@ export const getNonRequiredFieldsets = ( ) => { const node = document.getElementById(`${criteriaKey}`) - const dateDataObj = data.filter(item => item.criteriaKey === criteriaKey) + const notRequired = !node.attributes.required - const dateValues = dateDataObj[0].values.value + if (notRequired) { + const dateDataObj = data.filter(item => item.criteriaKey === criteriaKey) - const isEmpty = obj => { - for (const key in obj) { - if (obj[key] !== '') { - return false // returns false if object has a non-empty string value + const dateValues = dateDataObj[0].values.value + + const isEmpty = obj => { + for (const key in obj) { + if (obj[key] !== '') { + return false // returns false if object has a non-empty string value + } } + return true // returns true if all values are empty strings } - return true // returns true if all values are empty strings - } - const addToRequiredFields = [...requiredFieldsets, node] + const addToRequiredFields = [...requiredFieldsets, node] - const makeUniq = [...new Set(addToRequiredFields)] + const makeUniq = [...new Set(addToRequiredFields)] - const removeFromRequiredFields = makeUniq.filter( - item => !item.id === criteriaKey - ) + const removeFromRequiredFields = makeUniq.filter( + item => !item.id === criteriaKey + ) - const removeFromErrorArray = hasError.filter( - item => !item.id.includes(criteriaKey) - ) + const removeFromErrorArray = hasError.filter( + item => !item.id.includes(criteriaKey) + ) - isEmpty(dateValues) && setHasError(removeFromErrorArray) + isEmpty(dateValues) && setHasError(removeFromErrorArray) - isEmpty(dateValues) - ? setHandler(removeFromRequiredFields) - : setHandler(makeUniq) + isEmpty(dateValues) + ? setHandler(removeFromRequiredFields) + : setHandler(makeUniq) + } } export const handleCheckForRequiredValues = async ( From f04d633fa602d3edf9fd96df0f424fb3fcb6543d Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Thu, 5 Sep 2024 13:14:26 -0400 Subject: [PATCH 03/10] PXBF-dev: Add continue on error to failing step --- .github/workflows/increment_sub_hash.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/increment_sub_hash.yml b/.github/workflows/increment_sub_hash.yml index 519737a53..8d02d2c64 100644 --- a/.github/workflows/increment_sub_hash.yml +++ b/.github/workflows/increment_sub_hash.yml @@ -14,6 +14,7 @@ jobs: submodules: true # Checkout the submodule - name: Fetch latest commit in the submodule + continue-on-error: true run: | cd usagov-2021/ git fetch origin # Fetch the latest changes From 3db8b58e57bb50680833ea31fd6ae24da71eeb01 Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Thu, 5 Sep 2024 13:19:30 -0400 Subject: [PATCH 04/10] PXBF-1612-update-submodule-hash: Comment out with submodule in checkout step --- .github/workflows/increment_sub_hash.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/increment_sub_hash.yml b/.github/workflows/increment_sub_hash.yml index 8d02d2c64..1a789fbb8 100644 --- a/.github/workflows/increment_sub_hash.yml +++ b/.github/workflows/increment_sub_hash.yml @@ -10,9 +10,9 @@ jobs: steps: - name: Checkout repository with submodules uses: actions/checkout@v4 - with: - submodules: true # Checkout the submodule - + # with: + # submodules: true # Checkout the submodule + # - name: Fetch latest commit in the submodule continue-on-error: true run: | From c8b5a4a428225b429f01b7b18e43e663427057b6 Mon Sep 17 00:00:00 2001 From: scottqueen-bixal Date: Thu, 5 Sep 2024 13:59:21 -0400 Subject: [PATCH 05/10] PXBF-1779-replace-all-benefits-icon: replace all benefits icon for relevant benefits cards --- .../shared/components/Icon/index_icons.jsx | 336 +++++++++++++----- 1 file changed, 255 insertions(+), 81 deletions(-) diff --git a/benefit-finder/src/shared/components/Icon/index_icons.jsx b/benefit-finder/src/shared/components/Icon/index_icons.jsx index 325efe4e3..bec6e50fd 100644 --- a/benefit-finder/src/shared/components/Icon/index_icons.jsx +++ b/benefit-finder/src/shared/components/Icon/index_icons.jsx @@ -4,87 +4,261 @@ import Colors from '../../styles/colors/_index.js' // all-benefits export const AllBenefits = () => ( - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ) From 25f4c8ca3c85a3f5245567b38e2be0aee217aaaf Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Thu, 5 Sep 2024 13:59:42 -0400 Subject: [PATCH 06/10] PXBF-dev: Do the submodule upgrade via a PR --- .github/workflows/increment_sub_hash.yml | 35 ++++++++++++++++-------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/increment_sub_hash.yml b/.github/workflows/increment_sub_hash.yml index 8d02d2c64..a4ee74c56 100644 --- a/.github/workflows/increment_sub_hash.yml +++ b/.github/workflows/increment_sub_hash.yml @@ -8,21 +8,34 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository with submodules + - name: Checkout repository without submodules uses: actions/checkout@v4 with: - submodules: true # Checkout the submodule + submodules: false # Do not checkout submodules + fetch-depth: 0 # Necessary to fetch all history for branch creation - - name: Fetch latest commit in the submodule - continue-on-error: true + - name: Create new branch run: | - cd usagov-2021/ - git fetch origin # Fetch the latest changes - git checkout origin/main # Checkout the latest commit from submodule (replace 'main' with the submodule's branch) + git checkout -b update-submodule-hash-${{ github.run_id }} - - name: Push submodule update + - name: Update submodule to latest commit run: | cd usagov-2021/ - git push origin HEAD:main # Push the new commit of the submodule - env: - GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }} # Use GitHub token for authentication + git fetch + latest_commit=$(git rev-parse origin/main) # Get latest commit hash of the submodule + git config -f .gitmodules submodule.usagov-2021.branch main + cd .. + git submodule update --remote usagov-2021 + git add usagov-2021 + git commit -m "Updated submodule to latest commit $latest_commit" + git push origin HEAD:update-submodule-${{ github.run_id }} + + - name: Create Pull Request + uses: repo-sync/pull-request@v2 + with: + github_token: ${{ secrets.ADD_TO_PROJECT_PAT }} + pr_title: "Update Submodule to Latest Commit" + pr_body: "This pull request updates the submodule to the latest commit." + pr_label: "automated-pr" + destination_branch: ${{ github.ref_name }} # Target the branch this workflow runs against + From 61dbf27c684ac4b1b5b84fa360ea8cb8edc22981 Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Thu, 5 Sep 2024 14:07:33 -0400 Subject: [PATCH 07/10] PXBF-dev: Syntax fix --- .github/workflows/increment_sub_hash.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/increment_sub_hash.yml b/.github/workflows/increment_sub_hash.yml index ad1b92ab5..a0a6e2d34 100644 --- a/.github/workflows/increment_sub_hash.yml +++ b/.github/workflows/increment_sub_hash.yml @@ -13,6 +13,8 @@ jobs: with: submodules: false # Do not checkout submodules fetch-depth: 0 # Necessary to fetch all history for branch creation + + - name: Make PR Branch run: | git checkout -b update-submodule-hash-${{ github.run_id }} From c84ff67b0689be7ffd734aab1160c93a41425c06 Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Thu, 5 Sep 2024 14:14:29 -0400 Subject: [PATCH 08/10] PXBF-dev: Add git ident --- .github/workflows/increment_sub_hash.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/increment_sub_hash.yml b/.github/workflows/increment_sub_hash.yml index a0a6e2d34..7b3d37036 100644 --- a/.github/workflows/increment_sub_hash.yml +++ b/.github/workflows/increment_sub_hash.yml @@ -21,6 +21,8 @@ jobs: - name: Update submodule to latest commit run: | cd usagov-2021/ + git config --global user.name "Hash Pipeline" + git config --global user.email "hash@pipeline.com" git fetch latest_commit=$(git rev-parse origin/main) # Get latest commit hash of the submodule git config -f .gitmodules submodule.usagov-2021.branch main From 73fc86e017d945061d412e9c67aa88ff802f0ad9 Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Thu, 5 Sep 2024 14:21:28 -0400 Subject: [PATCH 09/10] PXBF-dev: Init Submodule --- .github/workflows/increment_sub_hash.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/increment_sub_hash.yml b/.github/workflows/increment_sub_hash.yml index 7b3d37036..27a042ad6 100644 --- a/.github/workflows/increment_sub_hash.yml +++ b/.github/workflows/increment_sub_hash.yml @@ -11,13 +11,17 @@ jobs: - name: Checkout repository without submodules uses: actions/checkout@v4 with: - submodules: false # Do not checkout submodules + submodules: false # Do not checkout submodules initially fetch-depth: 0 # Necessary to fetch all history for branch creation - name: Make PR Branch run: | git checkout -b update-submodule-hash-${{ github.run_id }} + - name: Initialize and update submodule + run: | + git submodule update --init --recursive usagov-2021 + - name: Update submodule to latest commit run: | cd usagov-2021/ @@ -25,9 +29,8 @@ jobs: git config --global user.email "hash@pipeline.com" git fetch latest_commit=$(git rev-parse origin/main) # Get latest commit hash of the submodule - git config -f .gitmodules submodule.usagov-2021.branch main + git checkout $latest_commit cd .. - git submodule update --remote usagov-2021 git add usagov-2021 git commit -m "Updated submodule to latest commit $latest_commit" git push origin HEAD:update-submodule-${{ github.run_id }} From 857b69eaac6668ec8bc96943076f9045b77e4a77 Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Thu, 5 Sep 2024 14:29:33 -0400 Subject: [PATCH 10/10] PXBF-dev: Init Submodule 2 --- .github/workflows/increment_sub_hash.yml | 29 +++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/increment_sub_hash.yml b/.github/workflows/increment_sub_hash.yml index 27a042ad6..11f5e4cc2 100644 --- a/.github/workflows/increment_sub_hash.yml +++ b/.github/workflows/increment_sub_hash.yml @@ -1,7 +1,7 @@ name: Update Submodule Hash on: - workflow_dispatch: # Allows manual trigger + workflow_dispatch: jobs: update-submodule: @@ -15,32 +15,35 @@ jobs: fetch-depth: 0 # Necessary to fetch all history for branch creation - name: Make PR Branch - run: | - git checkout -b update-submodule-hash-${{ github.run_id }} + run: git checkout -b update-submodule-hash-${{ github.run_id }} - name: Initialize and update submodule run: | git submodule update --init --recursive usagov-2021 + cd usagov-2021/ + git checkout origin/main - - name: Update submodule to latest commit + - name: Checkout submodule to latest main run: | - cd usagov-2021/ - git config --global user.name "Hash Pipeline" - git config --global user.email "hash@pipeline.com" + cd usagov-2021 + git config user.name "Hash Pipeline" + git config user.email "hash@pipeline.com" git fetch - latest_commit=$(git rev-parse origin/main) # Get latest commit hash of the submodule + latest_commit=$(git rev-parse origin/main) git checkout $latest_commit + + - name: Commit changes if there are any + run: | cd .. git add usagov-2021 - git commit -m "Updated submodule to latest commit $latest_commit" - git push origin HEAD:update-submodule-${{ github.run_id }} + git commit -m "Updated submodule to latest commit $latest_commit" || echo "No changes to commit" + git push --set-upstream origin update-submodule-hash-${{ github.run_id }} - name: Create Pull Request uses: repo-sync/pull-request@v2 with: github_token: ${{ secrets.ADD_TO_PROJECT_PAT }} pr_title: "Update Submodule to Latest Commit" - pr_body: "This pull request updates the submodule to the latest commit." + pr_body: "This pull request updates the submodule to the latest commit on main." pr_label: "automated-pr" - destination_branch: ${{ github.ref_name }} # Target the branch this workflow runs against - + destination_branch: ${{ github.ref_name }}