diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 4efa6e5..7e344cb 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -8,6 +8,8 @@ jobs: deploy-staging: name: Deploy to staging subaccount + permissions: + pull-requests: write needs: [test] runs-on: ubuntu-latest env: @@ -20,6 +22,7 @@ jobs: - name: Install near CLI run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/download/v0.7.0/near-cli-rs-installer.sh | sh - name: Create staging account + if: github.event.action == 'opened' || github.event.action == 'reopened' run: | near account create-account fund-myself "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" '10 NEAR' \ use-manually-provided-public-key "${{ vars.NEAR_CONTRACT_STAGING_ACCOUNT_PUBLIC_KEY }}" \ @@ -41,3 +44,9 @@ jobs: --signer-public-key "${{ vars.NEAR_CONTRACT_STAGING_ACCOUNT_PUBLIC_KEY }}" \ --signer-private-key "${{ secrets.NEAR_CONTRACT_STAGING_ACCOUNT_PRIVATE_KEY }}" \ send + + - name: Comment on pull request + env: + GH_TOKEN: ${{ github.token }} + run: | + gh pr comment "${{ github.event.number }}" --body "Staging contract is deployed to ["'`'"${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}"'`'" account](https://explorer.${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}.near.org/accounts/${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }})"