Skip to content

Commit

Permalink
dldlls: don't use empty token and try GITHUB_TOKEN
Browse files Browse the repository at this point in the history
Merge requests from other repositories will not have access to the
secret used for the ARTIFACT_ACCESS_TOKEN environment variable. The
variable will be set to an empty string. Using an empty token in the
Authorization header makes Github reject requests which would be
allowed without that header.

If the ARTIFACT_ACCESS_TOKEN is not available, try the GITHUB_TOKEN
to avoid the throttling of requests without authorization. It won't
work for downloading artifacts, though.
  • Loading branch information
s09bQ5 committed Sep 10, 2024
1 parent 579a89c commit 7e83966
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
7z x -y usdx-dlls-i686.zip -ogame "*.dll"
env:
ARTIFACT_ACCESS_TOKEN: ${{ secrets.MxeActionsReadAccessToken }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create installer
run: |
del game\*.debug
Expand Down
4 changes: 3 additions & 1 deletion dldlls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
}

token = os.environ.get('ARTIFACT_ACCESS_TOKEN')
if token != None:
if token == None or token.strip() == '':
token = os.environ.get('GITHUB_TOKEN')
if token != None and token.strip() != '':
headers['Authorization'] = 'Bearer ' + token

print('Searching for binaries built from commit ' + sha)
Expand Down

0 comments on commit 7e83966

Please sign in to comment.