mirror of
https://github.com/logos-messaging/packages.git
synced 2026-01-07 16:43:09 +00:00
GitHub actions (#1744)
* Add GitHub actions * Workflow typo * Workflow typo * Use GITHUB_TOKEN in build if available
This commit is contained in:
parent
7f690d35f0
commit
868b48a5af
16
.github/workflows/test.yml
vendored
Normal file
16
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
default:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: iffy/install-nim@v3
|
||||||
|
with:
|
||||||
|
version: stable
|
||||||
|
- run: nim c -d:ssl -r package_scanner.nim
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- run: node ./validate_json.js
|
||||||
@ -54,12 +54,16 @@ proc canFetchNimbleRepository(name: string, urlJson: JsonNode): bool =
|
|||||||
# nimble file in it
|
# nimble file in it
|
||||||
result = true
|
result = true
|
||||||
var url: string
|
var url: string
|
||||||
|
var client = newHttpClient(timeout=100000)
|
||||||
|
defer: client.close()
|
||||||
|
|
||||||
if not urlJson.isNil:
|
if not urlJson.isNil:
|
||||||
url = urlJson.str
|
url = urlJson.str
|
||||||
|
if url.startsWith("https://github.com"):
|
||||||
|
if existsEnv("GITHUB_TOKEN"):
|
||||||
|
client.headers = newHttpHeaders({"authorization": "Bearer " & getEnv("GITHUB_TOKEN")})
|
||||||
try:
|
try:
|
||||||
discard getContent(url, timeout=10000)
|
discard client.getContent(url)
|
||||||
except HttpRequestError, TimeoutError:
|
except HttpRequestError, TimeoutError:
|
||||||
echo "W: ", name, ": unable to fetch repo ", url, " ",
|
echo "W: ", name, ": unable to fetch repo ", url, " ",
|
||||||
getCurrentExceptionMsg()
|
getCurrentExceptionMsg()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user