diff --git a/.github/config/dep-report.json5 b/.github/config/dep-report.json5 index 824b82f13..c34800761 100644 --- a/.github/config/dep-report.json5 +++ b/.github/config/dep-report.json5 @@ -3,4 +3,10 @@ // Check package.json files for dependency updates. packageJsonPaths: ["react-app", "express-api"], + // List of packages to ignore when reporting in jira ticket(s) + ignoreList: ["xlsx"], + + // Sets what levels of dependencies to include in the jira ticket(s) + depLevels: ["minor", "major"], + } diff --git a/.github/helpers/npm-deps/parse_to_comment.py b/.github/helpers/npm-deps/parse_to_comment.py index cb7d3e03e..dd27bc5ea 100644 --- a/.github/helpers/npm-deps/parse_to_comment.py +++ b/.github/helpers/npm-deps/parse_to_comment.py @@ -72,9 +72,9 @@ ERR_LI = [] WARN_LI = [] # list of levels to include in report -LEVELS = [S_MINOR, S_MAJOR] +LEVELS = [] # if a variable name matches one in this list it will be left out of the normal list -IGNORE_LIST = ["xlsx"] +IGNORE_LIST = [] def set_level_and_exit_code(code, message): """ @@ -157,6 +157,22 @@ def get_env_variables(): # add to return object return_env['DEP_INPUT'] = decoded_str + try: + ignore_li = os.environ["ignoreList"] + except KeyError: + log(ERROR, "Unable to get < ignoreList >") + exit(ERROR) + # transform string of a list to a list and add to dict + return_env['IGNORE_LIST'] = json.loads(ignore_li) + + try: + dep_levels = os.environ["depLevels"] + except KeyError: + log(ERROR, "Unable to get < depLevels >") + exit(ERROR) + # transform string of a list to a list and add to dict + return_env['DEP_LEVELS'] = json.loads(dep_levels) + return return_env def create_comment_string(dep_level, dep_cmd, dep_li): @@ -397,11 +413,15 @@ def main(): dependencies in IGNORE_LIST and generate report updates in the levels specified in LEVELS. See doc above for sample input and output. """ + global IGNORE_LIST # pylint: disable=global-statement + global LEVELS # pylint: disable=global-statement # get envronment variables env_vars = get_env_variables() - # get the string to process + # get the string to process, ignore list, and dependency levels to report on github_output_string = env_vars['DEP_INPUT'] + IGNORE_LIST = env_vars["IGNORE_LIST"] + LEVELS = env_vars["DEP_LEVELS"] # convert input to json json_input = json.loads(github_output_string) diff --git a/.github/workflows/app-npm-dep-check.yml b/.github/workflows/app-npm-dep-check.yml index 2b45ade54..74ffbc0a5 100644 --- a/.github/workflows/app-npm-dep-check.yml +++ b/.github/workflows/app-npm-dep-check.yml @@ -27,7 +27,10 @@ jobs: parse-json5-config: runs-on: ubuntu-22.04 outputs: + # save output from dep-report.json5 to Github env variables packageJsonPaths: ${{ steps.parse_config.outputs.packageJsonPaths }} + ignoreList: ${{ steps.parse_config.outputs.ignoreList }} + depLevels: ${{ steps.parse_config.outputs.depLevels }} steps: # Checkout branch. @@ -77,6 +80,9 @@ jobs: needs: - parse-json5-config - parse-package-versions + env: + ignoreList: ${{ needs.parse-json5-config.outputs.ignoreList }} + depLevels: ${{ needs.parse-json5-config.outputs.depLevels }} outputs: commentContents: ${{ steps.create_comment.outputs.commentContents }} steps: