Skip to content

Commit

Permalink
Use a public auth token instead of the CI token, which requires a sep…
Browse files Browse the repository at this point in the history
…arate login step for a GHCR token
  • Loading branch information
varesa committed Apr 12, 2024
1 parent 4df9800 commit 8a9f799
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/prod.yml
Expand Up @@ -28,20 +28,20 @@ jobs:
import json
import base64
with urllib.request.urlopen('https://ghcr.io/token?scope=repository:wappuradio/webbi:pull') as f:
token = json.load(f)['token']
req = urllib.request.Request(
'https://ghcr.io/v2/wappuradio/webbi/tags/list',
headers={
'Authorization': 'Basic ' + base64.b64encode(sys.argv[1].encode()).decode()
}
headers={'Authorization': f'Bearer {token}'}
)
with urllib.request.urlopen(req) as f:
if sys.argv[2] in json.load(f)['tags']:
if sys.argv[1] in json.load(f)['tags']:
print('exists=true')
else:
print('exists=false')" \
\
"${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \
"${{ github.sha }}" \
>> $GITHUB_OUTPUT
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Expand Up @@ -28,20 +28,20 @@ jobs:
import json
import base64
with urllib.request.urlopen('https://ghcr.io/token?scope=repository:wappuradio/webbi:pull') as f:
token = json.load(f)['token']
req = urllib.request.Request(
'https://ghcr.io/v2/wappuradio/webbi/tags/list',
headers={
'Authorization': 'Basic ' + base64.b64encode(sys.argv[1].encode()).decode()
}
'https://ghcr.io/v2/wappuradio/webbi/tags/list',
headers={'Authorization': f'Bearer {token}'}
)
with urllib.request.urlopen(req) as f:
if sys.argv[2] in json.load(f)['tags']:
if sys.argv[1] in json.load(f)['tags']:
print('exists=true')
else:
print('exists=false')" \
\
"${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \
"${{ github.sha }}" \
>> $GITHUB_OUTPUT
Expand Down

0 comments on commit 8a9f799

Please sign in to comment.