From b837a8d0af9406d9ea940639111a70dcd8f498c5 Mon Sep 17 00:00:00 2001 From: Fernando Ledesma Date: Tue, 20 Jan 2026 12:20:55 -0500 Subject: [PATCH] add ci workflow for e2e testing --- .../workflows/trigger-lightning-node-e2e.yml | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/trigger-lightning-node-e2e.yml diff --git a/.github/workflows/trigger-lightning-node-e2e.yml b/.github/workflows/trigger-lightning-node-e2e.yml new file mode 100644 index 00000000..1a11dda5 --- /dev/null +++ b/.github/workflows/trigger-lightning-node-e2e.yml @@ -0,0 +1,88 @@ +name: Trigger Lightning Node E2E Tests + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + # Need write permission to create status checks (optional) + pull-requests: write + +jobs: + trigger-e2e: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Verify token access to lightning-node repository + env: + LIGHTNING_NODE_REPO: ${{ vars.LIGHTNING_NODE_REPO || 'CumuloGlobal/lightning-node' }} + TOKEN: ${{ secrets.LIGHTNING_NODE_DISPATCH_TOKEN || secrets.GITHUB_TOKEN }} + run: | + REPO_OWNER=$(echo "$LIGHTNING_NODE_REPO" | cut -d'/' -f1) + REPO_NAME=$(echo "$LIGHTNING_NODE_REPO" | cut -d'/' -f2) + + echo "Verifying access to repository: $LIGHTNING_NODE_REPO" + + # Test if we can access the repository + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \ + -H "Authorization: token $TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/$LIGHTNING_NODE_REPO") + + if [ "$HTTP_CODE" = "200" ]; then + echo "✅ Successfully verified access to $LIGHTNING_NODE_REPO" + elif [ "$HTTP_CODE" = "404" ]; then + echo "❌ Repository not found: $LIGHTNING_NODE_REPO" + echo "Please verify:" + echo " 1. The repository name is correct" + echo " 2. The token has access to this private repository" + echo " 3. The token owner is a member of the '$REPO_OWNER' organization" + exit 1 + elif [ "$HTTP_CODE" = "403" ]; then + echo "❌ Access forbidden. The token may not have sufficient permissions." + echo "Please verify:" + echo " 1. The token has 'repo' scope (for private repos)" + echo " 2. The token owner has access to the '$REPO_OWNER' organization" + echo " 3. The repository allows access from external tokens" + exit 1 + else + echo "❌ Unexpected error (HTTP $HTTP_CODE) when accessing $LIGHTNING_NODE_REPO" + exit 1 + fi + + - name: Trigger Lightning Node E2E Tests + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.LIGHTNING_NODE_DISPATCH_TOKEN || secrets.GITHUB_TOKEN }} + repository: ${{ vars.LIGHTNING_NODE_REPO || 'cumuloglobal/lightning-node' }} + event-type: mdk-checkout-pr + client-payload: | + { + "sha": "${{ github.event.pull_request.head.sha }}", + "ref": "${{ github.event.pull_request.head.ref }}", + "pr_number": ${{ github.event.pull_request.number }}, + "pr_url": "${{ github.event.pull_request.html_url }}", + "repo": "${{ github.repository }}" + } + + - name: Comment on PR + if: github.event_name == 'pull_request' + uses: actions/github-script@v7 + with: + script: | + const lightningNodeRepo = '${{ vars.LIGHTNING_NODE_REPO || 'cumuloglobal/lightning-node' }}'; + const comment = `🔗 Lightning Node E2E tests have been triggered for this PR. + + View the workflow run: https://github.com/${lightningNodeRepo}/actions/workflows/external-e2e.yml + + The tests will build packages from this PR branch and run integration tests against the Lightning Node infrastructure.`; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment + });