Skip to content

Demo of Github Action Workflow Changes #644

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

Merged
merged 6 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 20 additions & 30 deletions .github/workflows/deploy-to-control-plane-review-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ run-name: Deploy PR Review App - PR #${{ github.event.pull_request.number || git
# Controls when the workflow will run
on:
pull_request:
types: [opened, synchronize, reopened]
types: [synchronize, reopened]
issue_comment:
types: [created]
workflow_dispatch:
Expand All @@ -26,7 +26,6 @@ jobs:
deploy:
if: |
(github.event_name == 'pull_request') ||
(github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch') ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
Expand All @@ -41,34 +40,22 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# For push events, try to find associated PR first
if [[ "${{ github.event_name }}" == "push" ]]; then
PR_DATA=$(gh pr list --head "${{ github.ref_name }}" --json number,headRefName,headRefOid --jq '.[0]')
if [[ -n "$PR_DATA" ]]; then
PR_NUMBER=$(echo "$PR_DATA" | jq -r .number)
else
echo "No PR found for branch ${{ github.ref_name }}, skipping deployment"
echo "DO_DEPLOY=false" >> $GITHUB_ENV
exit 0
fi
else
# Get PR number based on event type
case "${{ github.event_name }}" in
"workflow_dispatch")
PR_NUMBER="${{ github.event.inputs.pr_number }}"
;;
"issue_comment")
PR_NUMBER="${{ github.event.issue.number }}"
;;
"pull_request")
PR_NUMBER="${{ github.event.pull_request.number }}"
;;
*)
echo "Error: Unsupported event type ${{ github.event_name }}"
exit 1
;;
esac
fi
# Get PR number based on event type
case "${{ github.event_name }}" in
"workflow_dispatch")
PR_NUMBER="${{ github.event.inputs.pr_number }}"
;;
"issue_comment")
PR_NUMBER="${{ github.event.issue.number }}"
;;
"pull_request")
PR_NUMBER="${{ github.event.pull_request.number }}"
;;
*)
echo "Error: Unsupported event type ${{ github.event_name }}"
exit 1
;;
esac

if [[ -z "$PR_NUMBER" ]]; then
echo "Error: Could not determine PR number"
Expand Down Expand Up @@ -125,6 +112,9 @@ jobs:

# Check if app exists and save state
if ! cpflow exists -a ${{ env.APP_NAME }}; then
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
exit 0
fi
echo "APP_EXISTS=false" >> $GITHUB_ENV
else
echo "APP_EXISTS=true" >> $GITHUB_ENV
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
const sections = {
commands: {
deploy: {
title: '## `/deploy`',
title: '## `/deploy-review-app`',
purpose: '**Purpose:** Deploy a review app for your pull request',
details: [
'**What it does:**',
Expand All @@ -43,7 +43,7 @@ jobs:
]
},
destroy: {
title: '## `/destroy`',
title: '## `/delete-review-app`',
purpose: '**Purpose:** Remove the review app for your pull request',
details: [
'**What it does:**',
Expand Down Expand Up @@ -94,9 +94,9 @@ jobs:
cleanup: {
title: '## Automatic Cleanup',
details: [
'Review apps are automatically destroyed when:',
'Review apps are automatically deleted when:',
'1. The pull request is closed',
'2. The `/destroy` command is used',
'2. The `/delete-review-app` command is used',
'3. A new deployment is requested (old one is cleaned up first)'
]
},
Expand Down
2 changes: 1 addition & 1 deletion client/app/bundles/comments/components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class Footer extends BaseComponent {
</a>
<a href="https://x.com/railsonmaui" className="flex gap-4 items-center">
<div className="w-16 h-16 bg-[url('../images/twitter_64.png')]" />
Rails On Maui on X (Twitter)
Rails On Maui on X
</a>
</div>
</footer>
Expand Down
Loading