forked from PhasesResearchLab/ULTERA-contribute
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (37 loc) · 1.38 KB
/
excel2csv.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
name: excel2csv
on: [push]
jobs:
run:
name: excel2csv
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: 'pyqalloy-contribute/requirements.txt'
- name: Install Dependencies
run: |
python -m pip install -r pyqalloy-contribute/requirements.txt
- name: Run excel2csv
run: |
python pyqalloy-contribute/pyqalloy-contribute/excel2csv.py .
- name: Calculate diff
id: diff
run: |
git add *.csv
DIFF_COUNT=$(git diff --cached --numstat | awk '{sum += $1 + $2} END {print sum}')
echo "diff_count=$DIFF_COUNT" >> $GITHUB_OUTPUT
- name: Extract changing DOIs and add them to a set
id: dois
run: |
DOIS=$(git diff --cached -U0 | grep '^[+-]' | grep -v '^+++\|^---' | awk -F',' '{print "`" $NF "`"}' | sort -u | tr '\n' ' ')
echo "dois=$DOIS" >> $GITHUB_OUTPUT
- name: Commit changes with Add & Commit
uses: EndBug/add-and-commit@v9
with:
message: '(auto) Data Tracking Action changed `${{ steps.diff.outputs.diff_count }}` lines / data points [Changed DOIs: ${{ steps.dois.outputs.dois }}]'
add: '*.csv'