44 workflow_dispatch : null
55
66permissions :
7- content : write
7+ contents : write
8+
9+ env :
10+ BRANCH_NAME : ${{ github.ref_name }}
811
912jobs :
1013 build :
@@ -16,36 +19,46 @@ jobs:
1619 steps :
1720 - uses : actions/checkout@v6
1821 with :
19- # lfs: true
20- ref : ${{ github.head_ref }}
22+ lfs : true
23+ ref : ${{ github.ref || github.ref_name }}
2124
22- - name : Configure Git and pull from LFS
25+ # https://github.com/actions/checkout?tab=readme-ov-file#push-a-commit-using-the-built-in-token
26+ - name : Configure Git for pushing from actions
27+ run : |
2328 git config user.name "github-actions[bot]"
2429 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
25- git config lfs.fetchexclude "reference"
26- git lfs pull
27-
28- - name : Set up Python
29- uses : actions/setup-python@v6
30- with :
31- python-version : ${{ matrix.python-version }}
32- cache : pip
3330
3431 - name : Install roman_imsim
35- run : pip install git+https://github.com/DukeCosmology/roman_imsim.git
32+ run : |
33+ python -m pip install --upgrade pip
34+ pip install git+https://github.com/DukeCosmology/roman_imsim.git@${BRANCH_NAME}
3635
3736 - name : Run GalSim
3837 run : |
39- galsim hack.yaml output.dir=reference/RomanWAS_new/images/truth output.truth.dir=reference/RomanWAS_new/truth
38+ galsim hack.yaml
4039
41- # https://github.com/actions/checkout?tab=readme-ov-file#push-a-commit-using-the-built-in-token
4240 - name : Commit and push output
4341 run : |
42+ if zdiff output/RomanWAS_new/images/truth/Roman_WAS_truth_J129_12909_4.fits.gz reference/RomanWAS_new/images/truth/Roman_WAS_truth_J129_12909_4.fits.gz; then
43+ echo "reference image is unchanged"
44+ else
45+ echo "reference image is changed"
46+ mv -v output/RomanWAS_new/images/truth/Roman_WAS_truth_J129_12909_4.fits.gz reference/RomanWAS_new/images/truth/Roman_WAS_truth_J129_12909_4.fits.gz
47+ fi
48+
49+ if diff output/RomanWAS_new/truth/Roman_WAS_index_J129_12909_4.txt reference/RomanWAS_new/truth/Roman_WAS_index_J129_12909_4.txt; then
50+ echo "reference table is unchanged"
51+ else
52+ echo "reference table is changed"
53+ mv -v output/RomanWAS_new/truth/Roman_WAS_index_J129_12909_4.txt reference/RomanWAS_new/truth/Roman_WAS_index_J129_12909_4.txt
54+ fi
55+
4456 if git diff --exit-code; then
4557 echo "reference/ is unchanged; no action needed"
4658 else
4759 echo "reference/ is changed; pushing updates"
4860 git add reference
49- git commit -m "Update reference image "
61+ git commit -m "Update reference"
5062 git push
5163 fi
64+
0 commit comments