Skip to content

Commit

Permalink
Merge pull request #219 from MikroElektronika/new-feature/index-legac…
Browse files Browse the repository at this point in the history
…y-packages

Added legacy package indexing for manual runs.
  • Loading branch information
StrahinjaJacimovic authored Dec 16, 2024
2 parents 8539867 + 073c5fb commit 7514b51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/checkIndexes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ on:
type: boolean
description: Fix the broken links with new ones?
default: false
index_legacy:
type: boolean
description: Re-index legacy compiler packages as well (MikroC libraries/only applicable to manual runs)?
default: false

push:
branches:
Expand Down Expand Up @@ -53,7 +57,7 @@ jobs:
FIX_ACTION=${{ github.event.inputs.fix }} # Capture the fix input
LOG_ONLY=$([[ "$FIX_ACTION" == "false" ]] && echo true || echo false) # Negate the fix input
echo "LOG_ONLY is set to $LOG_ONLY"
python -u scripts/check_indexes.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} ${{ secrets.ES_HOST }} ${{ secrets.ES_USER }} ${{ secrets.ES_PASSWORD }} ${{ secrets.ME_ES_HOST }} ${{ secrets.ME_ES_USER }} ${{ secrets.ME_ES_PASSWORD }} ${{ secrets.ES_INDEX_LIVE }} "--es_regex" "${{ github.event.inputs.regex }}" "--log_only" "$LOG_ONLY"
python -u scripts/check_indexes.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} ${{ secrets.ES_HOST }} ${{ secrets.ES_USER }} ${{ secrets.ES_PASSWORD }} ${{ secrets.ME_ES_HOST }} ${{ secrets.ME_ES_USER }} ${{ secrets.ME_ES_PASSWORD }} ${{ secrets.ES_INDEX_LIVE }} "--es_regex" "${{ github.event.inputs.regex }}" "--log_only" "$LOG_ONLY" "--index_legacy_packages" "${{ github.event.inputs.index_legacy }}"
continue-on-error: true # Ensure the workflow continues

- name: Check Indexed Links - Test
Expand All @@ -62,7 +66,7 @@ jobs:
FIX_ACTION=${{ github.event.inputs.fix }} # Capture the fix input
LOG_ONLY=$([[ "$FIX_ACTION" == "false" ]] && echo true || echo false) # Negate the fix input
echo "LOG_ONLY is set to $LOG_ONLY"
python -u scripts/check_indexes.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} ${{ secrets.ES_HOST }} ${{ secrets.ES_USER }} ${{ secrets.ES_PASSWORD }} ${{ secrets.ME_ES_HOST }} ${{ secrets.ME_ES_USER }} ${{ secrets.ME_ES_PASSWORD }} ${{ secrets.ES_INDEX_TEST }} "--es_regex" "${{ github.event.inputs.regex }}" "--log_only" "$LOG_ONLY"
python -u scripts/check_indexes.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} ${{ secrets.ES_HOST }} ${{ secrets.ES_USER }} ${{ secrets.ES_PASSWORD }} ${{ secrets.ME_ES_HOST }} ${{ secrets.ME_ES_USER }} ${{ secrets.ME_ES_PASSWORD }} ${{ secrets.ES_INDEX_TEST }} "--es_regex" "${{ github.event.inputs.regex }}" "--log_only" "$LOG_ONLY" "--index_legacy_packages" "${{ github.event.inputs.index_legacy }}"
continue-on-error: true # Ensure the workflow continues

push_to_main_run:
Expand Down
4 changes: 4 additions & 0 deletions scripts/check_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def str2bool(v):
parser.add_argument("--es_regex", help="Regex to use to fetch indexed items", type=str, default=".+")
parser.add_argument("--log_only", help="If True, will not fix broken links, just log them to std out", type=str2bool, default=False)
parser.add_argument("--index_package_names", help="If True, will add \"gh_package_name\" to indexed item", type=str2bool, default=True)
parser.add_argument("--index_legacy_packages", help="If True, will re-index legacy compiler packages to DBP", type=str2bool, default=False)
args = parser.parse_args()

es_instance = es.index(
Expand All @@ -46,6 +47,9 @@ def str2bool(v):

gh_instance = gh.repo(args.gh_repo, args.gh_token)

if args.index_legacy_packages:
args.es_regex += '|^legacy_.+$'

es_instance.fetch(regex=args.es_regex)

headers = {
Expand Down

0 comments on commit 7514b51

Please sign in to comment.