Skip to content

Commit

Permalink
Sync CSV and Excel fro LSR Mappings (#80)
Browse files Browse the repository at this point in the history
Automated conversion from csv to excel for LSR mappings
  • Loading branch information
b-gehrke authored Apr 24, 2024
1 parent 316c82d commit a8fb0c0
Show file tree
Hide file tree
Showing 6 changed files with 608 additions and 469 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/convert_lsr_mappings_to_csv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
push:
branches:
- main
paths:
- "Mapping to LSRs/Mental Health Ontology mapping to LSRs.xlsx"
permissions:
contents: write
jobs:
get_context:
runs-on: ubuntu-latest
outputs:
action_bot_email: "41898282+github-actions[bot]@users.noreply.github.com"
commit_author: ${{ steps.get_author.outputs.out }}
steps:
- uses: actions/checkout@v4
- id: get_author
run: >
echo out=$(git log -1 "$SHA" --format="%aE") >> "$GITHUB_OUTPUT"
env:
SHA: ${{ github.sha }}
convert_to_csv:
runs-on: ubuntu-latest
name: Convert LSR mapping from Excel to CSV
needs: get_context
if: ${{ needs.get_context.outputs.commit_author != needs.get_context.outputs.action_bot_email }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: pip install -r scripts/requirements.txt
- name: Run conversion
run: python3 scripts/excel2csv.py -i "Mapping to LSRs/Mental Health Ontology mapping to LSRs.xlsx"
- uses: EndBug/add-and-commit@v9 # You can change this to use a specific version.
with:
add: '"Mapping to LSRs"'
default_author: 'github_actions'
message: "Converted LSR mapping Excel to CSV"
push: true
43 changes: 43 additions & 0 deletions .github/workflows/convert_lsr_mappings_to_xslx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on:
push:
branches:
- main
paths:
- "Mapping to LSRs/Mental Health Ontology mapping to LSRs.csv"
permissions:
contents: write
jobs:
get_context:
runs-on: ubuntu-latest
outputs:
action_bot_email: "41898282+github-actions[bot]@users.noreply.github.com"
commit_author: ${{ steps.get_author.outputs.out }}
steps:
- uses: actions/checkout@v4
- id: get_author
run: >
echo out=$(git log -1 "$SHA" --format="%aE") >> "$GITHUB_OUTPUT"
env:
SHA: ${{ github.sha }}

convert_to_excel:
runs-on: ubuntu-latest
name: Convert LSR mapping from CSV to Excel
needs: get_context
if: ${{ needs.get_context.outputs.commit_author != needs.get_context.outputs.action_bot_email }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: pip install -r scripts/requirements.txt
- name: Run conversion
run: python3 scripts/csv2excel.py -i "Mapping to LSRs/Mental Health Ontology mapping to LSRs.csv"
- uses: EndBug/add-and-commit@v9 # You can change this to use a specific version.
with:
add: '"Mapping to LSRs"'
default_author: 'github_actions'
message: "Converted LSR mapping CSV to Excel"
push: true
Loading

0 comments on commit a8fb0c0

Please sign in to comment.