From 65441250efa22c34315a3a6b933e18ce2a5b7c68 Mon Sep 17 00:00:00 2001 From: Alejandro Mota Date: Tue, 25 Feb 2025 16:03:58 -0800 Subject: [PATCH] Try new fix for format workflow --- .github/workflows/ci.yaml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a46b9f0..f866d88 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,11 +16,13 @@ jobs: steps: - name: Check out code uses: actions/checkout@v4 + with: + fetch-depth: 0 # Ensures full commit history for branch creation - name: Set up Julia uses: julia-actions/setup-julia@v1 with: - version: '1.11' # Adjust as needed + version: '1.11' - name: Install JuliaFormatter run: julia -e 'using Pkg; Pkg.add("JuliaFormatter"); Pkg.update()' @@ -40,12 +42,20 @@ jobs: BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} echo "Detected branch: $BRANCH_NAME" - git switch "$BRANCH_NAME" 2>/dev/null || git checkout -B "$BRANCH_NAME" + git switch -c format/${BRANCH_NAME} git commit -m "Auto-format code using JuliaFormatter (spaces only)" - git push origin "$BRANCH_NAME" - fi + git push https://x-access-token:${GH_PAT}@github.com/sandialabs/Norma.jl.git HEAD:format/${BRANCH_NAME} env: - GITHUB_TOKEN: ${{ secrets.GH_PAT }} + GH_PAT: ${{ secrets.GH_PAT }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GH_PAT }} + branch: format/${BRANCH_NAME} + title: "Auto-format code using JuliaFormatter" + body: "This PR applies auto-formatting to the codebase." + base: main test: name: Run Tests