Skip to content

Conversation

rmartinoscar
Copy link
Member

@rmartinoscar rmartinoscar commented Sep 30, 2025

This is a draft cause its not updating Laravel as it should see #1790
It also doesn't git add . before pushing so filament assets aren't published.

@rmartinoscar rmartinoscar self-assigned this Sep 30, 2025
Copy link

coderabbitai bot commented Sep 30, 2025

📝 Walkthrough

Walkthrough

Adds a new GitHub Actions workflow at .github/workflows/shift.yaml named "Shift" that triggers manually and weekly (cron: Friday 00:00 UTC). Runs on ubuntu-latest and posts form-encoded api_token, code, and scs to https://laravelshift.com/api/run using curl.

Changes

Cohort / File(s) Summary of Changes
GitHub Actions workflow
.github/workflows/shift.yaml
New workflow "Shift". Triggers: workflow_dispatch and cron (0 0 * * FRI). Single job on ubuntu-latest runs a curl -sf POST to https://laravelshift.com/api/run with form fields: api_token (from secrets), code (repository), scs (ref name). Sets Accept: application/json.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant S as Scheduler (Cron)
  participant G as GitHub Actions
  participant R as Runner (ubuntu-latest)
  participant L as Laravel Shift API

  rect rgba(230,240,255,0.5)
  alt Manual trigger
    U->>G: workflow_dispatch
  else Scheduled trigger
    S->>G: cron (Fri 00:00 UTC)
  end
  end

  G->>R: Start job
  note right of R: Build form payload from context & secrets\n- api_token (secret)\n- code (owner/repo)\n- scs (ref_name)

  R->>L: POST /api/run (form: api_token, code, scs)\nAccept: application/json
  alt Success (2xx)
    L-->>R: JSON response
  else Failure (non-2xx)
    L-->>R: Error (curl -sf causes step failure)
  end

  R-->>G: Job status
Loading

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description is empty and does not convey any details about the addition of the Shift workflow, so it fails to provide any context or relevance to the changeset. Please add a brief description summarizing the purpose and behavior of the new Shift workflow, including its trigger conditions and the action it performs.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Create shift workflow” directly reflects the primary change of adding a new GitHub Actions workflow file named shift.yaml and concisely describes the introduction of the Shift workflow without extraneous information.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2851f2 and 1d6f490.

📒 Files selected for processing (1)
  • .github/workflows/shift.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/shift.yaml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/shift (1)

1-19: Critical: Missing file extension prevents workflow from running.

The workflow file lacks the required .yml or .yaml extension. GitHub Actions will not recognize or execute this workflow without it.

Rename the file to include the proper extension:

.github/workflows/shift.yml
🧹 Nitpick comments (2)
.github/workflows/shift (2)

8-11: Add a timeout to prevent hung jobs.

The job lacks a timeout specification, which means it could run for up to 6 hours (GitHub's default) if the curl command hangs.

Add a reasonable timeout:

 jobs:
   shift:
     runs-on: ubuntu-latest
+    timeout-minutes: 5
     steps:

12-18: Enhance error handling and observability.

The curl command will fail on HTTP errors but provides minimal feedback for debugging. Consider adding response validation and explicit timeouts.

Apply these improvements:

       - name: Shift
         run: |
-          curl -sf -X POST https://laravelshift.com/api/run \
+          response=$(curl -sf --max-time 30 --fail-with-body -X POST https://laravelshift.com/api/run \
             -H "Accept: application/json" \
             -d "api_token=${{ secrets.SHIFT_TOKEN }}" \
             -d "code=${{ secrets.SHIFT_CODE }}" \
-            -d "scs=github:${{ github.repository }}:${{ github.ref_name }}"
+            -d "scs=github:${{ github.repository }}:${{ github.ref_name }}")
+          echo "LaravelShift API response: $response"

This adds:

  • --max-time 30: Timeout after 30 seconds
  • --fail-with-body: Show error response body on HTTP errors
  • Response capture and logging for debugging
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f02b58c and de14e54.

📒 Files selected for processing (1)
  • .github/workflows/shift (1 hunks)
🔇 Additional comments (2)
.github/workflows/shift (2)

3-6: LGTM!

The trigger configuration is well-structured with both manual dispatch and weekly scheduling on Fridays at midnight UTC.


14-18: Endpoint and parameters verified. The https://laravelshift.com/api/run endpoint and parameters (api_token, code, scs) align with the official LaravelShift API specification, and scs is correctly formatted as github:owner/repo:branch per docs.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/shift.yaml (1)

14-18: Consider improving error visibility and timeout handling.

The -sf flags will suppress useful debugging information on failure. The -s flag is appropriate for hiding the progress bar, but -f causes curl to fail silently on HTTP errors without showing response bodies that might contain error details.

Consider this approach for better observability:

       - name: Shift
         run: |
-          curl -sf -X POST https://laravelshift.com/api/run \
+          curl -s --max-time 60 --fail-with-body -X POST https://laravelshift.com/api/run \
             -H "Accept: application/json" \
             -d "api_token=${{ secrets.SHIFT_TOKEN }}" \
             -d "code=${{ secrets.SHIFT_CODE }}" \
             -d "scs=github:${{ github.repository }}:${{ github.ref_name }}"

Changes:

  • --fail-with-body (curl 7.76+) preserves error response bodies for debugging
  • --max-time 60 prevents indefinite hangs
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between de14e54 and e2851f2.

📒 Files selected for processing (1)
  • .github/workflows/shift.yaml (1 hunks)
🔇 Additional comments (2)
.github/workflows/shift.yaml (2)

3-6: LGTM! Trigger configuration is appropriate.

The combination of workflow_dispatch for manual execution and weekly cron schedule is well-suited for a maintenance workflow like LaravelShift.


18-18: Verify branch targeting behavior.

The github.ref_name will resolve to different branches depending on the trigger:

  • Manual dispatch: The branch from which the workflow was triggered
  • Scheduled run: The default branch (typically main)

Ensure this behavior aligns with your LaravelShift configuration. If you always want to shift a specific branch, consider hardcoding it or using a workflow input for manual runs.

Example with explicit branch control:

on:
  workflow_dispatch:
    inputs:
      branch:
        description: 'Branch to shift'
        required: false
        default: 'main'
  schedule:
    - cron: "0 0 * * 5"

jobs:
  shift:
    runs-on: ubuntu-latest
    steps:
      - name: Shift
        run: |
          BRANCH="${{ github.event.inputs.branch || 'main' }}"
          curl -s --max-time 60 --fail-with-body -X POST https://laravelshift.com/api/run \
            -H "Accept: application/json" \
            -d "api_token=${{ secrets.SHIFT_TOKEN }}" \
            -d "code=${{ secrets.SHIFT_CODE }}" \
            -d "scs=github:${{ github.repository }}:${BRANCH}"

@rmartinoscar rmartinoscar marked this pull request as draft October 9, 2025 21:18
steps:
- name: Shift
run: |
curl -X POST -s -retry 5 -m 60 --fail-with-body \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
curl -X POST -s -retry 5 -m 60 --fail-with-body \
curl -X POST -s --retry 5 -m 60 --fail-with-body \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants