Process ATLAS ROOT Open Data v1 #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Process ATLAS ROOT Open Data v1 | |
on: | |
workflow_dispatch: | |
inputs: | |
data_file: | |
description: 'Path to the Data URLs input file' | |
default: 'data.csv' | |
required: true | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
files: ${{ steps.read_file.outputs.files }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Read CSV File and Prepare Jobs | |
id: read_file | |
run: | | |
files=$(jq -R -s -c 'split("\n")[:-1]' < ${{ github.event.inputs.data_file }}) | |
echo "files=$files" >> $GITHUB_OUTPUT | |
process-file: | |
needs: setup | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Grant write access to allow pushing changes | |
strategy: | |
fail-fast: false | |
matrix: | |
file: ${{ fromJSON(needs.setup.outputs.files) }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run ROOT Script in Docker | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: rootproject/root:latest | |
options: --rm -v ${{ github.workspace }}:/workspace | |
run: | | |
cd /workspace | |
python3 example.py "${{ matrix.file }}" | |
- name: Commit and Push Histogram Plot | |
if: always() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add plots/histogram_*.png || echo "No plot generated" | |
git diff --cached --exit-code || git commit -m "Add updated histogram plot" --allow-empty | |
# Pull the latest changes and rebase before pushing | |
git fetch origin main | |
git rebase origin/main | |
git push --force-with-lease origin HEAD:main |