Chat/add images and examples for UI component docs #77
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Review App | |
on: | |
pull_request: | |
types: [labeled, unlabeled, closed] | |
jobs: | |
manage-review-app: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
deployments: write | |
pull-requests: read | |
if: | | |
(github.event.action == 'labeled' && github.event.label.name == 'review-app') || | |
(github.event.action == 'unlabeled' && github.event.label.name == 'review-app') || | |
(github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'review-app')) | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check if user is an Ably organization member | |
if: github.event.action == 'labeled' && github.event.label.name == 'review-app' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.ABLY_ORG_TOKEN }} | |
script: | | |
try { | |
const labelCreator = context.actor; | |
console.log(`Label creator: ${labelCreator}`); | |
// Check if user is a member of the Ably organization | |
const { data: membership } = await github.rest.orgs.getMembershipForUser({ | |
org: 'ably', | |
username: labelCreator | |
}); | |
console.log(`Membership state: ${membership.state}`); | |
console.log(`Membership role: ${membership.role}`); | |
// Check if user is an active member (not just pending invitation) | |
if (membership.state !== 'active') { | |
core.setFailed(`User ${labelCreator} does not have active membership in the Ably organization`); | |
return; | |
} | |
console.log(`✅ User ${labelCreator} is an active member of the Ably organization`); | |
} catch (error) { | |
// If we get a 404, the user is not a member of the organization | |
if (error.status === 404) { | |
core.setFailed(`User ${context.actor} is not a member of the Ably organization`); | |
} else { | |
core.setFailed(`Failed to check Ably organization membership: ${error.message}`); | |
} | |
} | |
- name: Manage Heroku Review App | |
uses: fastruby/[email protected] | |
with: | |
action: ${{ (github.event.action == 'labeled' && github.event.label.name == 'review-app' && 'create') || 'destroy' }} | |
env: | |
HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }} | |
HEROKU_PIPELINE_ID: ${{ secrets.HEROKU_PIPELINE_ID }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |