4444
4545 - name : Get SOFA nightly build link
4646 id : sofa_nightly_link
47- run : echo "::set-output name=link::$(curl -s 'https://api.github.com/repos/jnbrunet/sofa/actions/artifacts' | python3 -c "import sys,json,re;print(sorted(filter(lambda a:re.search('${{ matrix.os }}', a['name'], re.I),json.load(sys.stdin)['artifacts']), reverse=False, key=lambda a:a['created_at'])[-1]['archive_download_url'])")"
48- shell : bash
47+ shell : python
48+ run : |
49+ import urllib.request, json, sys, re
50+ url = 'https://api.github.com/repos/jnbrunet/sofa/actions/artifacts'
51+ req = urllib.request.Request(url)
52+ req.add_header('authorization', 'Bearer ${{ secrets.GITHUB_TOKEN }}')
53+ r = urllib.request.urlopen(req).read()
54+ artifacts = json.loads(r.decode('utf-8'))['artifacts']
55+ os_artifacts = filter(lambda a:re.search('${{ matrix.os }}', a['name'], re.I), artifacts)
56+ last_artifact_url = sorted(os_artifacts, reverse=False, key=lambda a:a['created_at'])[-1]['archive_download_url']
57+ print(f"::set-output name=link::{last_artifact_url}")
4958
5059 - name : Cache SOFA
5160 uses : actions/cache@v2
5665
5766 - name : Download SOFA nightly build
5867 if : steps.sofa_cache.outputs.cache-hit != 'true'
59- run : curl --output sofa.zip
60- -u jnbrunet:$TOKEN -L -o sofa.zip /
68+ run : |
69+ curl --output sofa.zip \
70+ --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
71+ -u jnbrunet:$TOKEN -L -o sofa.zip / \
6172 ${{ steps.sofa_nightly_link.outputs.link }}
6273
6374 - name : Install SOFA nightly build
@@ -125,10 +136,20 @@ jobs:
125136 - name : Install requirements
126137 run : |
127138 python3 -m pip install numpy
139+
128140 - name : Get SOFA nightly build link
129141 id : sofa_nightly_link
130- run : echo "::set-output name=link::$(curl -s 'https://api.github.com/repos/jnbrunet/sofa/actions/artifacts' | python3 -c "import sys,json,re;print(sorted(filter(lambda a:re.search('ubuntu-18\.04', a['name'], re.I),json.load(sys.stdin)['artifacts']), reverse=False, key=lambda a:a['created_at'])[-1]['archive_download_url'])")"
131- shell : bash
142+ shell : python
143+ run : |
144+ import urllib.request, json, sys, re
145+ url = 'https://api.github.com/repos/jnbrunet/sofa/actions/artifacts'
146+ req = urllib.request.Request(url)
147+ req.add_header('authorization', 'Bearer ${{ secrets.GITHUB_TOKEN }}')
148+ r = urllib.request.urlopen(req).read()
149+ artifacts = json.loads(r.decode('utf-8'))['artifacts']
150+ os_artifacts = filter(lambda a:re.search('${{ matrix.os }}', a['name'], re.I), artifacts)
151+ last_artifact_url = sorted(os_artifacts, reverse=False, key=lambda a:a['created_at'])[-1]['archive_download_url']
152+ print(f"::set-output name=link::{last_artifact_url}")
132153
133154 - name : Cache SOFA
134155 uses : actions/cache@v2
@@ -139,8 +160,10 @@ jobs:
139160
140161 - name : Download SOFA nightly build
141162 if : steps.sofa_cache.outputs.cache-hit != 'true'
142- run : curl --output sofa.zip
143- -u jnbrunet:$TOKEN -L -o sofa.zip /
163+ run : |
164+ curl --output sofa.zip \
165+ --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
166+ -u jnbrunet:$TOKEN -L -o sofa.zip / \
144167 ${{ steps.sofa_nightly_link.outputs.link }}
145168
146169 - name : Install SOFA nightly build
0 commit comments