-
-
Notifications
You must be signed in to change notification settings - Fork 225
Create shift workflow #1765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Create shift workflow #1765
Conversation
📝 WalkthroughWalkthroughAdds a new GitHub Actions workflow at Changes
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
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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. 🧪 Early access (Sonnet 4.5): enabledWe 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:
Comment |
There was a problem hiding this 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
📒 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. Thehttps://laravelshift.com/api/run
endpoint and parameters (api_token
,code
,scs
) align with the official LaravelShift API specification, andscs
is correctly formatted asgithub:owner/repo:branch
per docs.
There was a problem hiding this 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
📒 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}"
steps: | ||
- name: Shift | ||
run: | | ||
curl -X POST -s -retry 5 -m 60 --fail-with-body \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curl -X POST -s -retry 5 -m 60 --fail-with-body \ | |
curl -X POST -s --retry 5 -m 60 --fail-with-body \ |
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.