-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.72 KB
/
julialang versions CORS.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: "Check availability of versions.json"
on:
schedule:
- cron: "37 0,6,12,18 * * *"
workflow_dispatch:
jobs:
checkCORS:
runs-on: ubuntu-latest
steps:
- uses: denoland/setup-deno@v1
with:
deno-version: "1.29.4"
- uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
require("fs").writeFileSync("context.json", JSON.stringify(context))
- name: Check CORS
run: |
deno eval '
const response = await fetch("https://julialang-s3.julialang.org/bin/versions.json")
const data = await response.json()
if(Object.keys(data).length < 50) {
console.error("weird response")
console.log(data)
Deno.exit(1)
}
if(response.headers.get("access-control-allow-origin") !== "*") {
console.error("No CORS header")
console.log(response.headers)
Deno.exit(1)
}
console.log(data)
'
- name: Report failure
if: ${{ failure() }}
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/issues/10/comments \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'X-GitHub-Api-Version: 2022-11-28' \
--header 'content-type: application/json' \
--data '{
"body": "😵💫 https://julialang-s3.julialang.org/bin/versions.json is not working!\n\n📄 Log: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}.\n\n![](https://media.giphy.com/media/l4FsIC6XXeS0wGIBG/giphy.gif)"
}'