Skip to content

Commit 0adf8a9

Browse files
authored
Merge pull request hed-standard#1109 from VisLab/action_update
First pass at eliminating secrets
2 parents 8defee5 + 2d01830 commit 0adf8a9

5 files changed

Lines changed: 21 additions & 32 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
pull_request:
77
branches: ["*"]
88

9+
permissions:
10+
contents: read
11+
id-token: write
12+
913
jobs:
1014
determine_version:
1115
runs-on: ubuntu-latest
@@ -58,14 +62,14 @@ jobs:
5862
# Run spec tests without coverage for non Python 3.9
5963
- name: Run spec_test
6064
env:
61-
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
GITHUB_TOKEN: ${{ github.token }}
6266
continue-on-error: true
6367
run: |
6468
python -m unittest discover spec_tests
6569
6670
# Run unittest without coverage
6771
- name: Test with unittest
6872
env:
69-
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
GITHUB_TOKEN: ${{ github.token }}
7074
run: |
7175
python -m unittest discover tests

.github/workflows/ci_cov.yaml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,13 @@ on:
66
pull_request:
77
branches: ["*"]
88

9-
jobs:
9+
permissions:
10+
contents: read
11+
id-token: write
1012

11-
check-secret:
12-
runs-on: ubuntu-latest
13-
outputs:
14-
secrets-exist: ${{ steps.check-for-secrets.outputs.defined }}
15-
steps:
16-
- name: Check for Secret availability
17-
id: check-for-secrets
18-
# perform secret check & put boolean result as an output
19-
shell: bash
20-
run: |
21-
if [ "${{ secrets.QLTY_COVERAGE_TOKEN }}" != '' ]; then
22-
echo "defined=true" >> $GITHUB_OUTPUT;
23-
else
24-
echo "defined=false" >> $GITHUB_OUTPUT;
25-
fi
13+
jobs:
2614

2715
build:
28-
needs: check-secret
2916
strategy:
3017
matrix:
3118
platform: [ubuntu-latest]
@@ -57,24 +44,22 @@ jobs:
5744
# Run unittest with coverage
5845
- name: Test with unittest and coverage
5946
env:
60-
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
GITHUB_TOKEN: ${{ github.token }}
6148
continue-on-error: true
6249
run: |
6350
coverage run -m unittest discover tests
6451
6552
# Run spec tests with coverage
6653
- name: Run spec_test coverage
6754
env:
68-
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
GITHUB_TOKEN: ${{ github.token }}
6956
run: |
7057
coverage run --append -m unittest discover spec_tests
7158
coverage xml
7259
ls -la
7360
7461
# Upload coverage to qlty
7562
- name: Upload coverage to qlty
76-
if: needs.check-secret.outputs.secrets-exist == 'true'
7763
uses: qltysh/qlty-action/coverage@v2
7864
with:
79-
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
8065
files: coverage.xml

hed/models/base_input.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"""
44
import os
55
from typing import Union
6-
76
import openpyxl
87
import pandas as pd
9-
8+
from hed.models.column_metadata import ColumnMetadata
9+
from hed.models.definition_dict import DefinitionDict
1010
from hed.models.column_mapper import ColumnMapper
1111
from hed.errors.exceptions import HedFileError, HedExceptions
1212

@@ -269,11 +269,11 @@ def columns(self) -> list[str]:
269269
columns = list(self._dataframe.columns)
270270
return columns
271271

272-
def column_metadata(self) -> dict[int, 'ColumnMeta']:
272+
def column_metadata(self) -> dict[int, 'ColumnMetadata']:
273273
""" Return the metadata for each column.
274274
275275
Returns:
276-
dict[int, 'ColumnMeta']: Number/ColumnMeta pairs.
276+
dict[int, ColumnMetadata]: Number/ColumnMetadata pairs.
277277
"""
278278
if self._mapper:
279279
return self._mapper._final_column_map

hed/models/column_mapper.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,13 @@ def set_tag_columns(self, tag_columns=None, optional_tag_columns=None, finalize_
206206
if finalize_mapping:
207207
self._finalize_mapping()
208208

209-
def set_column_map(self, new_column_map=None) -> list[dict]:
209+
def set_column_map(self, new_column_map=None):
210210
""" Set the column number to name mapping.
211211
212212
Parameters:
213213
new_column_map (list or dict): Either an ordered list of the column names or column_number:column name.
214214
dictionary. In both cases, column numbers start at 0.
215215
216-
Returns:
217-
list[dict]: List of issues. Each issue is a dictionary.
218-
219216
"""
220217
if new_column_map is None:
221218
new_column_map = {}

hed/schema/schema_io/schema_util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ def get_api_key():
2323
try:
2424
return os.environ["HED_GITHUB_TOKEN"]
2525
except KeyError:
26-
return github_api_access_token
26+
try:
27+
return os.environ["GITHUB_TOKEN"]
28+
except KeyError:
29+
return github_api_access_token
2730

2831

2932
def make_url_request(resource_url, try_authenticate=True):

0 commit comments

Comments
 (0)