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

[Do not merge] WIP: new airbyte-ci slash command #36838

Closed
wants to merge 1 commit into from
Closed
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
141 changes: 141 additions & 0 deletions .github/workflows/airbyte-ci-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Internal Poetry packages CI


on:
workflow_dispatch:
inputs:
comment-id:
description: 'Comment ID (Optional)'
type: string
required: false
connector:
description: "The name of the connector to test. E.g. 'source-faker'"
type: string
required: true
repo:
description: "Repo to check out code from. Defaults to the main airbyte repo."
type: choice
required: true
default: airbytehq/airbyte
options:
- airbytehq/airbyte
gitref:
description: "The git ref to check out from the specified repository."
required: true

jobs:
log-starting-comment:
name: Append 'Starting' Comment
runs-on: ubuntu-latest
steps:
- name: Create URL to the run output
id: vars
run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
- name: Append comment with job run link
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.inputs.comment-id }}
body: |

> PR test job started... [Check job output.][1]

[1]: ${{ steps.vars.outputs.run-url }}

airbyte-ci-test:
name: On-Demand Test (`airbyte-ci`)
runs-on: ubuntu-latest
steps:

- name: Checkout PR
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.inputs.gitref }}

- name: Install `airbyte-ci`
run: |
pipx install airbyte-ci

- name: Run `airbyte-ci` test
run: |
airbyte-ci connector --name=${{ github.event.inputs.connector }} test

airbyte-ci-fix:
name: On-Demand Auto-Fix (`airbyte-ci`)
runs-on: ubuntu-latest
steps:

- name: Checkout PR
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.inputs.gitref }}

- name: Install `airbyte-ci`
run: |
pipx install airbyte-ci

- name: Run `airbyte-ci` fix
run: |
airbyte-ci connector --name=${{ github.event.inputs.connector }} fix all

# Check for changes in git

- name: Check for changes
id: git-diff
run: |
git diff --quiet && echo "No changes to commit" || echo "::set-output name=changes::true"
shell: bash

# Commit changes (if any)

- name: Commit changes
if: steps.git-diff.outputs.changes == 'true' && github.ref != 'refs/heads/master'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Chore: `airbyte-ci` auto-fix"
commit_user_name: Octavia Squidington III
commit_user_email: octavia-squidington-iii@users.noreply.github.com

- name: Append 'fixed' comment
if: steps.git-diff.outputs.changes == 'true' && github.ref != 'refs/heads/master'
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.inputs.comment-id }}
reactions: hooray
body: |
> 🟦 `airbyte-ci` fixed one or more problems.

log-test-success-comment:
name: Append 'Test Success' Comment
needs: [airbyte-ci-test]
runs-on: ubuntu-latest
steps:
- name: Append success comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.inputs.comment-id }}
reactions: hooray
body: |
> ✅ `airbyte-ci` tests passed.

log-fixes-applied-comment:
name: Append 'Fixed' Comment
needs: [airbyte-ci-fix]
runs-on: ubuntu-latest
steps:

log-failure-comment:
name: Append 'Failure' Comment
# This job will only run if the workflow fails
needs: [airbyte-ci-test]
if: always() && needs.airbyte-ci-test.result == 'failure'
runs-on: ubuntu-latest
steps:
- name: Append failure comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.inputs.comment-id }}
reactions: confused
body: |
> ❌ `airbyte-ci` tests failed.
1 change: 1 addition & 0 deletions .github/workflows/slash-commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
permission: write
commands: |
airbyte-ci
test
legacy-test
test-performance
Expand Down
Loading