-
Notifications
You must be signed in to change notification settings - Fork 16
77 lines (71 loc) · 2.42 KB
/
check-s3.yml
File metadata and controls
77 lines (71 loc) · 2.42 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Check and verify files are available on S3
on:
push:
branches: [ master ]
tags: [ '*' ]
schedule:
- cron: '0 9 * * 0' # Every Sunday at 9 AM UTC
workflow_dispatch:
jobs:
verify_s3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup uv
uses: astral-sh/setup-uv@v7
- name: Install tools
run: |
uv tool install git-annex
uv tool install datalad
- name: git identification
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
- name: Install all datasets
run: uvx datalad install -r .
- name: Check S3 files
id: s3check
run: uv run .github/scripts/check-s3.py
env:
CONCURRENT_REQUESTS: 50
- name: Open issue on S3 errors
if: failure() && steps.s3check.outcome == 'failure'
uses: actions/github-script@v8
env:
S3_ERRORS: ${{ steps.s3check.outputs.errors }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const title = `S3 availability check failed (${new Date().toISOString().slice(0, 10)})`;
const formatted = process.env.S3_ERRORS;
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const { data: existing } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 's3',
});
const open = existing.find(i => i.title === title);
if (open) {
core.info(`Issue already exists: ${open.html_url}`);
return;
}
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title,
body: [
'## S3 File Availability Check Failed',
'',
`See the [failed workflow run](${runUrl}) for full details.`,
'',
'### Affected files',
'',
formatted,
'',
'_This issue was opened automatically by the check S3 workflow._',
].join('\n'),
labels: ['s3'],
});