Mobile UI doesn't show authorization #25
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: Build@preview | |
| on: | |
| pull_request: | |
| branches: | |
| - "gh/**" | |
| - "dev/**" | |
| issue_comment: | |
| types: [created] | |
| jobs: | |
| check-membership: | |
| # First check if this is a PR comment with the trigger phrase | |
| if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '!gh run') }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is-member: ${{ steps.check-membership.outputs.is_member }} | |
| steps: | |
| - name: Check organization membership | |
| id: check-membership | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| try { | |
| // Get the organization name from the repository | |
| const orgName = context.repo.owner; | |
| const username = context.payload.comment.user.login; | |
| // Check if the user is a member of the organization | |
| const { status } = await github.request('GET /orgs/{org}/members/{username}', { | |
| org: orgName, | |
| username: username | |
| }); | |
| // If we got here without an error, the user is a member | |
| console.log(`User ${username} is a member of ${orgName}`); | |
| core.setOutput('is_member', 'true'); | |
| } catch (error) { | |
| if (error.status === 404) { | |
| console.log(`User ${context.payload.comment.user.login} is not a member of the organization`); | |
| // Post a comment that only org members can use this command | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `⚠️ @${context.payload.comment.user.login} - Only organization members can use the \`!gh run\` command.` | |
| }); | |
| core.setOutput('is_member', 'false'); | |
| } else { | |
| throw error; | |
| } | |
| } | |
| build: | |
| needs: check-membership | |
| if: ${{ needs.check-membership.outputs.is-member == 'true' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: "Checkout repo" | |
| uses: actions/checkout@v4 | |
| - name: "Clone preview" | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| ref: preview | |
| path: preview | |
| - name: "Setup Bun" | |
| uses: oven-sh/setup-bun@v2 | |
| - name: "Install dependencies" | |
| run: bun install | |
| - name: Build | |
| run: bun run build | |
| - name: Clean up previous build | |
| run: | | |
| rm -rf ./preview/* | |
| - name: Copy preview build | |
| run: | | |
| rsync -a dist/* ./preview | |
| - name: Publish | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| cwd: "preview" | |
| add: "." | |
| author_name: github-actions[bot] | |
| author_email: 41898282+github-actions[bot]@users.noreply.github.com | |
| message: "Automatic commit, run id: ${{ github.run_id }}" | |
| push: true |