-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regression tests: require manual approval for certified connectors (#…
…41627) Co-authored-by: Augustin <augustin@airbyte.io>
- Loading branch information
1 parent
310e6bd
commit fdf3764
Showing
6 changed files
with
127 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Approve Regression Tests | ||
permissions: | ||
pull-requests: write | ||
status: write # to allow the GITHUB_TOKEN to post a commit status | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
pr: | ||
description: "Pull request number. Used to pull the proper branch ref, including on forks." | ||
type: number | ||
required: false | ||
comment-id: | ||
description: "Optional. The comment-id of the slash command. Used to update the comment with the status." | ||
required: false | ||
|
||
# These must be declared, but they are unused and ignored. | ||
# TODO: Infer 'repo' and 'gitref' from PR number on other workflows, so we can remove these. | ||
repo: | ||
description: "Repo (Ignored)" | ||
required: false | ||
default: "airbytehq/airbyte" | ||
gitref: | ||
description: "Ref (Ignored)" | ||
required: false | ||
|
||
run-name: "Approve Regression Tests #${{ github.event.inputs.pr }}" | ||
|
||
jobs: | ||
approve-regression-tests: | ||
name: "Approve Regression Tests" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get job variables | ||
id: job-vars | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
shell: bash | ||
run: | | ||
PR_JSON=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }}) | ||
echo "PR_JSON: $PR_JSON" | ||
echo "repo=$(echo "$PR_JSON" | jq -r .head.repo.full_name)" >> $GITHUB_OUTPUT | ||
BRANCH=$(echo "$PR_JSON" | jq -r .head.ref) | ||
echo "branch=$BRANCH" >> $GITHUB_OUTPUT | ||
echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT | ||
LATEST_COMMIT=$(gh api repos/${{ github.repository }}/commits/$BRANCH | jq -r .sha) | ||
echo "latest_commit=$LATEST_COMMIT" >> $GITHUB_OUTPUT | ||
- name: Append comment with job run link | ||
# If comment-id is not provided, this will create a new | ||
# comment with the job run link. | ||
id: first-comment-action | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
comment-id: ${{ github.event.inputs.comment-id }} | ||
issue-number: ${{ github.event.inputs.pr }} | ||
body: | | ||
> [Check job output.][1] | ||
[1]: ${{ steps.job-vars.outputs.run-url }} | ||
- name: Approve regression tests | ||
id: approve | ||
run: | | ||
echo "approving ...." | ||
response=$(curl --write-out '%{http_code}' --silent --output /dev/null \ | ||
--request POST \ | ||
--url ${{ github.api_url }}/repos/${{ github.repository }}/statuses/${{ steps.job-vars.outputs.latest_commit }} \ | ||
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | ||
--header 'content-type: application/json' \ | ||
--data '{ | ||
"state": "success", | ||
"context": "Regression tests manual approval", | ||
"target_url": "https://github.com/airbytehq/airbyte/tree/master/airbyte-ci/connectors/live-tests" | ||
}') | ||
if [ $response -ne 201 ]; then | ||
echo "Failed to approve regression tests. HTTP status code: $response" | ||
exit 1 | ||
else | ||
echo "Regression tests approved." | ||
fi | ||
- name: Append success comment | ||
uses: peter-evans/create-or-update-comment@v4 | ||
if: success() | ||
with: | ||
comment-id: ${{ steps.first-comment-action.outputs.comment-id }} | ||
reactions: "+1" | ||
body: | | ||
> ✅ Approving regression tests | ||
- name: Append failure comment | ||
uses: peter-evans/create-or-update-comment@v4 | ||
if: failure() | ||
with: | ||
comment-id: ${{ steps.first-comment-action.outputs.comment-id }} | ||
reactions: confused | ||
body: | | ||
> ❌ Regression test approval failed |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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