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

[wallet-ext] Workflow run wallet extension #4766

Merged
merged 4 commits into from
Sep 26, 2022
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
47 changes: 47 additions & 0 deletions .github/workflows/wallet-ext-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Wallet Extension PR Comment

# NOTE: This workflow run indirection is used to securely comment on PRs when
# wallet builds are completed.
on:
workflow_run:
workflows: ["Wallet Extension PR Checks"]
types:
- completed

jobs:
upload:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: "Download artifact"
uses: actions/github-script@v6
id: get-artifact
with:
result-encoding: string
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "wallet-extension"
})[0];
if (!matchArtifact) {
return '';
}
return matchArtifact.archive_download_url;
- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
if: steps.get-artifact.outputs.result != ''
with:
comment_includes: "💳 Wallet Extension"
message: |
💳 Wallet Extension has been built, you can download the packaged extension here: ${{steps.get-artifact.outputs.result}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 4 additions & 11 deletions .github/workflows/wallet-ext-prs.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: Wallet Extension PR checks
name: Wallet Extension PR Checks
on: pull_request
jobs:
diff:
runs-on: [ubuntu-latest]
runs-on: ubuntu-latest
outputs:
isWalletExt: ${{ steps.diff.outputs.isWalletExt }}
steps:
- uses: actions/checkout@v3
- name: Detect Changes
uses: "./.github/actions/pnpm-diffs"
id: diff

run_checks:
name: Lint, Test & Build
needs: diff
if: needs.diff.outputs.isWalletExt == 'true'
runs-on: [ubuntu-latest]
runs-on: ubuntu-latest
env:
working-directory: ./wallet
steps:
Expand Down Expand Up @@ -43,16 +44,8 @@ jobs:
working-directory: ${{env.working-directory}}
run: pnpm pack:zip
- uses: actions/upload-artifact@v2
if: always()
with:
name: wallet-extension
path: wallet/web-ext-artifacts/*
if-no-files-found: error
retention-days: 7
- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
with:
comment_includes: "💳 Wallet Extension"
message: |
💳 Wallet Extension has been built, you can download the packaged extension here: https://github.com/MystenLabs/sui/actions/runs/${{ github.run_id }}#artifacts
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}