Skip to content

Fixes

Fixes #146

name: Deriv App ID Generator
permissions:
actions: write
checks: write
contents: write
deployments: write
pull-requests: write
statuses: write
on:
issue_comment:
types: [edited]
jobs:
generate_app_id:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Capture Vercel preview URL
id: vercel_preview_url
uses: binary-com/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
preview_url_regexp: \[Visit Preview\]\((.*?.sx)\)
- name: Generate Deriv App ID for deployment Preview URL
id: generate_app_id
uses: deriv-com/deriv-app-id-action@v1
with:
DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }}
DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
max_retries: 5
vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}
- name: Comment on pull request with App ID and URLs
id: sticky_comment_on_pr
if: steps.generate_app_id.outputs.should_post_comment
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
header: deriv-app-id-action
number: ${{github.event.issue.number}}
message: |
A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}))
- **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }})
- **URLs**:
- **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=red.derivws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}
- **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}
- **App ID**: `${{ steps.generate_app_id.outputs.app_id }}`
<details>
<summary>Click here to copy & paste above information.</summary>
```
- **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }})
- **URLs**:
- **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=red.derivws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}
- **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}
- **App ID**: `${{ steps.generate_app_id.outputs.app_id }}`
```
</details>
- name: Store generated URL in artifact
run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=red.derivws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt
- name: Upload artifact
uses: actions/upload-artifact@master
with:
name: generated_url
path: ${{ github.workspace }}/url.txt
retention-days: 1