diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a635f8033..1030ef2fe 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,6 +6,10 @@ on: pull_request: branches: ["*"] +permissions: + contents: read + id-token: write + jobs: determine_version: runs-on: ubuntu-latest @@ -58,7 +62,7 @@ jobs: # Run spec tests without coverage for non Python 3.9 - name: Run spec_test env: - HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} continue-on-error: true run: | python -m unittest discover spec_tests @@ -66,6 +70,6 @@ jobs: # Run unittest without coverage - name: Test with unittest env: - HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} run: | python -m unittest discover tests diff --git a/.github/workflows/ci_cov.yaml b/.github/workflows/ci_cov.yaml index 33e53151f..46e155684 100644 --- a/.github/workflows/ci_cov.yaml +++ b/.github/workflows/ci_cov.yaml @@ -6,26 +6,13 @@ on: pull_request: branches: ["*"] -jobs: +permissions: + contents: read + id-token: write - check-secret: - runs-on: ubuntu-latest - outputs: - secrets-exist: ${{ steps.check-for-secrets.outputs.defined }} - steps: - - name: Check for Secret availability - id: check-for-secrets - # perform secret check & put boolean result as an output - shell: bash - run: | - if [ "${{ secrets.QLTY_COVERAGE_TOKEN }}" != '' ]; then - echo "defined=true" >> $GITHUB_OUTPUT; - else - echo "defined=false" >> $GITHUB_OUTPUT; - fi +jobs: build: - needs: check-secret strategy: matrix: platform: [ubuntu-latest] @@ -57,7 +44,7 @@ jobs: # Run unittest with coverage - name: Test with unittest and coverage env: - HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} continue-on-error: true run: | coverage run -m unittest discover tests @@ -65,7 +52,7 @@ jobs: # Run spec tests with coverage - name: Run spec_test coverage env: - HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} run: | coverage run --append -m unittest discover spec_tests coverage xml @@ -73,8 +60,6 @@ jobs: # Upload coverage to qlty - name: Upload coverage to qlty - if: needs.check-secret.outputs.secrets-exist == 'true' uses: qltysh/qlty-action/coverage@v2 with: - token: ${{ secrets.QLTY_COVERAGE_TOKEN }} files: coverage.xml diff --git a/hed/models/base_input.py b/hed/models/base_input.py index 547b4c9df..6f49587ee 100644 --- a/hed/models/base_input.py +++ b/hed/models/base_input.py @@ -3,10 +3,10 @@ """ import os from typing import Union - import openpyxl import pandas as pd - +from hed.models.column_metadata import ColumnMetadata +from hed.models.definition_dict import DefinitionDict from hed.models.column_mapper import ColumnMapper from hed.errors.exceptions import HedFileError, HedExceptions @@ -269,11 +269,11 @@ def columns(self) -> list[str]: columns = list(self._dataframe.columns) return columns - def column_metadata(self) -> dict[int, 'ColumnMeta']: + def column_metadata(self) -> dict[int, 'ColumnMetadata']: """ Return the metadata for each column. Returns: - dict[int, 'ColumnMeta']: Number/ColumnMeta pairs. + dict[int, ColumnMetadata]: Number/ColumnMetadata pairs. """ if self._mapper: return self._mapper._final_column_map diff --git a/hed/models/column_mapper.py b/hed/models/column_mapper.py index 59ae9c5bc..aa3c036ef 100644 --- a/hed/models/column_mapper.py +++ b/hed/models/column_mapper.py @@ -206,16 +206,13 @@ def set_tag_columns(self, tag_columns=None, optional_tag_columns=None, finalize_ if finalize_mapping: self._finalize_mapping() - def set_column_map(self, new_column_map=None) -> list[dict]: + def set_column_map(self, new_column_map=None): """ Set the column number to name mapping. Parameters: new_column_map (list or dict): Either an ordered list of the column names or column_number:column name. dictionary. In both cases, column numbers start at 0. - Returns: - list[dict]: List of issues. Each issue is a dictionary. - """ if new_column_map is None: new_column_map = {} diff --git a/hed/schema/schema_io/schema_util.py b/hed/schema/schema_io/schema_util.py index 3fa50692c..efc2430c1 100644 --- a/hed/schema/schema_io/schema_util.py +++ b/hed/schema/schema_io/schema_util.py @@ -23,7 +23,10 @@ def get_api_key(): try: return os.environ["HED_GITHUB_TOKEN"] except KeyError: - return github_api_access_token + try: + return os.environ["GITHUB_TOKEN"] + except KeyError: + return github_api_access_token def make_url_request(resource_url, try_authenticate=True):