Skip to content
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

Bala/add app-id integration #1304

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
63 changes: 63 additions & 0 deletions .github/workflows/generate-app-id.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Deriv App ID Generator

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: smart-charts-deriv-app-integration.*\[Visit Preview\]\((.*.sx)\)
- name: Generate Deriv App ID for deployment Preview URL
id: generate_app_id
uses: binary-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@v1
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=frontend.binaryws.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=frontend.binaryws.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=frontend.binaryws.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