refactor(ci): Remove PR comment step - commit status is sufficient #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Fork PR Connector Tests | ||
Check failure on line 1 in .github/workflows/fork-connector-tests.yml
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
permissions: | ||
contents: read | ||
statuses: write | ||
pull-requests: write | ||
jobs: | ||
check-fork-and-trigger-tests: | ||
name: Check Fork and Trigger Tests | ||
runs-on: ubuntu-24.04 | ||
if: github.event.pull_request.head.repo.full_name != github.repository | ||
steps: | ||
- name: Attempt to get GitHub App token for fork | ||
id: get-app-token | ||
continue-on-error: true | ||
uses: actions/create-github-app-token@v2 | ||
with: | ||
app-id: ${{ secrets.OCTAVIA_BOT_APP_ID }} | ||
private-key: ${{ secrets.OCTAVIA_BOT_PRIVATE_KEY }} | ||
owner: ${{ github.event.pull_request.head.repo.owner.login }} | ||
- name: Skip message for missing GitHub App | ||
if: steps.get-app-token.outcome != 'success' | ||
run: | | ||
echo "Skipping fork connector tests - GitHub App not installed on fork" | ||
echo "Fork owner '${{ github.event.pull_request.head.repo.owner.login }}' needs to install the Airbyte GitHub App" | ||
- name: Post pending commit status | ||
if: steps.get-app-token.outcome == 'success' | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github+json" \ | ||
"${{ github.api_url }}/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }}" \ | ||
-d '{ | ||
"state": "pending", | ||
"context": "Fork Connector Tests", | ||
"description": "Running connector tests in fork with BYO secrets...", | ||
"target_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
}' | ||
- name: Trigger connector tests in fork | ||
id: trigger-tests | ||
if: steps.get-app-token.outcome == 'success' | ||
uses: the-actions-org/workflow-dispatch@v4 | ||
with: | ||
token: ${{ steps.get-app-token.outputs.token }} | ||
repo: ${{ github.event.pull_request.head.repo.full_name }} | ||
workflow: connector-ci-checks.yml | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
wait-for-completion: true | ||
wait-for-completion-timeout: 2h | ||
wait-for-completion-interval: 30s | ||
inputs: | | ||
{ | ||
"repo": "${{ github.event.pull_request.head.repo.full_name }}", | ||
"gitref": "${{ github.event.pull_request.head.ref }}", | ||
"pr": "${{ github.event.pull_request.number }}" | ||
} | ||
- name: Post success commit status | ||
if: steps.trigger-tests.outcome == 'success' && steps.trigger-tests.outputs.workflow-conclusion == 'success' | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github+json" \ | ||
"${{ github.api_url }}/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }}" \ | ||
-d '{ | ||
"state": "success", | ||
"context": "Fork Connector Tests", | ||
"description": "Connector tests passed in fork with BYO secrets", | ||
"target_url": "${{ steps.trigger-tests.outputs.workflow-url }}" | ||
}' | ||
- name: Post failure commit status | ||
if: steps.get-app-token.outcome == 'success' && (steps.trigger-tests.outcome == 'failure' || steps.trigger-tests.outputs.workflow-conclusion != 'success') | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github+json" \ | ||
"${{ github.api_url }}/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }}" \ | ||
-d '{ | ||
"state": "failure", | ||
"context": "Fork Connector Tests", | ||
"description": "Connector tests failed in fork with BYO secrets", | ||
"target_url": "${{ steps.trigger-tests.outputs.workflow-url || format(''{0}/{1}/actions/runs/{2}'', github.server_url, github.repository, github.run_id) }}" | ||
}' |