-
Notifications
You must be signed in to change notification settings - Fork 4
58 lines (56 loc) · 2.7 KB
/
ExportData.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
53
54
55
56
57
58
name: Export Data
on:
release:
types: [published]
workflow_dispatch:
env:
OPENBIS_V3: https://localhost:8128/openbis/openbis/rmi-application-server-v3.json
OPENBISMANTIC_API: https://localhost:8128/openbismantic
SAMPLE_TYPE: EXPERIMENTAL_STEP_EMODUL
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
submodules: recursive
- name: run app
run: |
touch .env
echo ADMIN_PASS=example >> .env
echo OBSERVER_PASS=example >> .env
echo HOST_NAME=127.0.0.1 >> .env
echo OPENBIS_PORT=8127 >> .env
echo OPENBIS_SSL_PORT=8128 >> .env
echo POSTGRES_PASSWORD=example >> .env
echo GROUP_NAME=openbis >> .env
echo GROUP_ID=1000 >> .env
echo OPENBISMANTIC_URL=https://openbis.matolab.org >> .env
docker compose up -d
docker compose logs -f init_database
- name: Update exported data
run: |
rm -rf exported_data
mkdir -p exported_data
token=$(curl -sk -d "{\"method\": \"login\", \"params\": [\"admin\", \"example\"], \"id\": \"1\", \"jsonrpc\": \"2.0\"}" ${{env.OPENBIS_V3}} | jq -r '.result')
if [[ $token == "null" ]]
then
echo "failed to log in"
exit 1
fi
echo "logged in successfully"
permIds=$(curl -sk -d "{\"method\":\"searchSamples\",\"params\":[\"${token}\",{\"@id\":0,\"criteria\":[{\"@id\":1,\"criteria\":[{\"@id\":2,\"fieldName\":\"code\",\"fieldType\":\"ATTRIBUTE\",\"fieldValue\":{\"@id\":3,\"value\":\"${{env.SAMPLE_TYPE}}\",\"@type\":\"as.dto.common.search.StringEqualToValue\"},\"useWildcards\":false,\"@type\":\"as.dto.common.search.CodeSearchCriteria\"}],\"@type\":\"as.dto.sample.search.SampleTypeSearchCriteria\",\"operator\":\"AND\"}],\"relation\":\"SAMPLE\",\"operator\":\"AND\",\"negated\":false,\"@type\":\"as.dto.sample.search.SampleSearchCriteria\"},{\"type\": {\"@type\": \"as.dto.sample.fetchoptions.SampleTypeFetchOptions\"}}],\"id\":\"1\",\"jsonrpc\":\"2.0\"}" ${{env.OPENBIS_V3}} | jq -r '[.result.objects[].permId.permId]|join(" ")')
echo "found samples ${permIds}"
for permId in $permIds
do
result=$(curl -sk -H "Cookie: openbis=${token}" "${{env.OPENBISMANTIC_API}}/object/${permId}")
echo $result >> "exported_data/${permId}.json"
done
- name: commit results
uses: EndBug/add-and-commit@v9
with:
message: 'update exported data'
add: '*.* --force'
cwd: './exported_data/'