name: MVS Upload & Execute on: push: branches: [ master ] pull_request: branches: [ master ] jobs: upload-and-run: steps: - name: Checkout code uses: actions/checkout@v4 - name: Find changed source files id: files run: | echo "=== Debug: Starting file detection ===" echo "Current dir: $(pwd)" echo "Files in repo: $(ls -la)" echo "=== Debug: Running git diff ===" # Try to list changed .c or .bas files from last commit CHANGED_FILES=$(git diff --name-only HEAD~1 -- '*.c' '*.bas' 2>/dev/null | head -1) echo "Changed files from last commit: '${CHANGED_FILES}'" echo "=== Debug: Git diff complete ===" # Fallback to all .c/.bas files if no previous commit or no changes if [ -z "$CHANGED_FILES" ]; then echo "=== Debug: No changes found; running fallback find ===" CHANGED_FILES=$(find . -name "*.c" -o -name "*.bas" | head -1) echo "Fallback files: '${CHANGED_FILES}'" echo "=== Debug: Fallback complete ===" fi if [ -z "$CHANGED_FILES" ]; then echo "No C/BAS files found; skipping workflow." exit 0 # Graceful skip, no failure fi echo "=== Debug: Processing final file ===" echo "Final selected file: '${CHANGED_FILES}'" echo "file=$CHANGED_FILES" >> $GITHUB_OUTPUT # Extract member name (handle .c or .bas) EXT="${CHANGED_FILES##*.}" BASE=$(basename "$CHANGED_FILES" ".$EXT") echo "member=$BASE" >> $GITHUB_OUTPUT echo "=== Debug: File detection complete ===" - name: Upload to PDS and Submit JCL if: steps.files.outputs.file != '' run: | echo "=== Debug: Starting upload/submit ===" echo "File: ${{ steps.files.outputs.file }}" echo "Member: ${{ steps.files.outputs.member }}" cd /home/gmgauthier/Retro/mvs/src/ python3 mvs_job.py "${{ steps.files.outputs.file }}" "@05054.SRCLIB.C" "${{ steps.files.outputs.member }}" "COMPILE" echo "=== Debug: Upload/submit complete ===" env: MVS_HOST: "oldcomputernerd.com" - name: Report Status run: | echo "Upload/Compile complete! Check TK5 JES for JOB ${{ steps.files.outputs.member }} output."