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/Refactor generate preview link workflow #588

Merged
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
28 changes: 16 additions & 12 deletions .github/workflows/generate_preview_link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ on:
types:
- completed

env:
HEAD_REF: ${{ github.head_ref }}

concurrency:
group: cloudflare-pages-build-${{ github.event.workflow_run.head_branch }}
group: cloudflare-pages-build-"$HEAD_REF"
cancel-in-progress: true

jobs:
build_and_deploy_preview_link:
runs-on: Ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
Expand All @@ -39,7 +38,18 @@ jobs:
id: pr_information
run: |
echo "username=$(cat .pr/USERNAME)" >> $GITHUB_OUTPUT
echo "issue_number=$(cat .pr/NR)" >> $GITHUB_OUTPUT
echo "issue_number=$(cat .pr/ISSUE_NUMBER)" >> $GITHUB_OUTPUT

- name: Verify user
uses: "deriv-com/shared-actions/.github/actions/verify_user_in_organization@v1"
with:
username: ${{steps.pr_information.outputs.username}}
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}

- name: Post preview build comment
id: post_preview_build_comment
Expand All @@ -48,12 +58,6 @@ jobs:
issue_number: ${{steps.pr_information.outputs.issue_number}}
head_sha: ${{github.event.workflow_run.head_sha}}

- name: Verify user
uses: "deriv-com/shared-actions/.github/actions/verify_user_in_organization@v1"
with:
username: ${{steps.pr_information.outputs.username}}
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

- name: Setup Node
uses: actions/setup-node@v1
with:
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/pre_generate_preview_link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,25 @@ on:
pull_request:
types: [opened, synchronize]

env:
HEAD_REF: ${{ github.head_ref }}

concurrency:
group: cloudflare-pages-verify-${{ github.head_ref }}
group: cloudflare-pages-verify-"$HEAD_REF"
cancel-in-progress: true

jobs:
upload_pr_info:
runs-on: Ubuntu-latest
steps:
- name: Retrieve PR information
env:
ISSUE_NUMBER: ${{ github.event.number }}
USERNAME: ${{ github.event.pull_request.user.login }}
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
echo ${{ github.event.pull_request.user.login }} > ./pr/USERNAME
echo "$ISSUE_NUMBER" > ./pr/ISSUE_NUMBER
echo "$USERNAME" > ./pr/USERNAME

- name: Upload PR information to artifact
uses: actions/upload-artifact@v2
Expand Down
Loading