Skip to content

Commit

Permalink
updating where ignore list and dep levels are set
Browse files Browse the repository at this point in the history
  • Loading branch information
TaylorFries committed Nov 12, 2024
1 parent e41ea53 commit 9bfb9f6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/config/dep-report.json5
Original file line number Diff line number Diff line change
Expand Up @@ -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"],

}
26 changes: 23 additions & 3 deletions .github/helpers/npm-deps/parse_to_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/app-npm-dep-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 9bfb9f6

Please sign in to comment.