generated from ioxio-dataspace/definitions-template
-
Notifications
You must be signed in to change notification settings - Fork 6
56 lines (46 loc) · 1.63 KB
/
convert.yaml
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
name: Convert definitions
on:
push:
branches: ["main"]
jobs:
Test:
name: Run validation
uses: ./.github/workflows/validation-template.yaml
Convert:
name: Convert definitions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1
- name: Set up Python 🐍
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 #v5.2.0
with:
python-version: 3.11
- name: Install python dependencies
run: pip install pre-commit ioxio-data-product-definition-tooling
- name: Generate definitions
run: convert-definitions src DataProducts
- name: Commit and push
run: |
git status
if [[ -z $(git status -s) ]]; then
echo "No changes detected"
else
set -x
git config --local user.name "${BOT_NAME}"
git config --local user.email "${BOT_EMAIL}"
git fetch --depth=1
git checkout "${BRANCH}"
git add .
# format files if necessary
pre-commit run --all-files || true
git add .
# run validation one more time. this time exit on error
pre-commit run --all-files
git commit -m "Convert definitions" -a
git push https://${GITHUB_ACTOR}:${TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:${BRANCH}
fi
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: ${{ github.ref_name }}
BOT_NAME: github-actions[bot]
BOT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com