Skip to content

Commit

Permalink
Syncing frontend label studio to backend (#4)
Browse files Browse the repository at this point in the history
## Summary:
Updating the sync frontend code to work with our repositories. This workflow is run under 2 circumstances:

1. A weekly scheduled sync
2. When a PR is merged to the main branch of the label-studio-frontend repository

Frontend testing is done within the frontend repo itself. This workflow buils the docs and static assets for the site (basically replacing the manual sync we need to do in ml-infra).

Also fixing an issue with the notify slack action.

Issue: https://khanacademy.atlassian.net/browse/DI-529

## Test plan:
- ran scheduled sync in workflow testing branch to verify it sends the dispatch message: https://github.com/Khan/label-studio/actions/runs/6255067305
- ran merge job manually in workflow-testing (had to hardcode commit values because repository_dispatch action can only send to the default branch): b9e663e, c3edf97
- deployed ml-infra to test environment off of this workflow-testing branch, verified Jimmy's firefox fix is in: https://github.com/Khan/ml-infra/actions/runs/6255236042

<img width="745" alt="Screenshot 2023-09-20 at 16 46 52" src="https://github.com/Khan/label-studio/assets/50882112/ff8350cb-08ce-408f-b883-02cdce3b78df">

Author: lizfaubell

Reviewers: dat-boris, jimmykodes, lizfaubell

Required Reviewers:

Approved By: dat-boris, jimmykodes

Checks: ✅ Submodules/deps, ✅ Submodules/deps

Pull Request URL: #4
  • Loading branch information
lizfaubell authored Sep 21, 2023
1 parent f10a663 commit 695ea6d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 426 deletions.
8 changes: 6 additions & 2 deletions .github/actions/notify_slack/action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Notify Slack on workflow failure
description: notifies infrastructure-data-alerts channel on workflow failure.

inputs:
webhook_url:
description: "Slack webhook url"
required: true

runs:
using: "composite"
steps:
- name: Notify slack on failure
if: failure()
uses: slackapi/[email protected]
with:
payload: |
Expand All @@ -17,4 +21,4 @@ runs:
}
env:
# Notifies the #infrastructure-data-alerts channel.
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_URL: ${{ inputs.webhook_url }}
17 changes: 13 additions & 4 deletions .github/workflows/follow-merge-lsf-sync-schedule.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: 'Follow Merge: LSF Sync'
name: 'Scheduled Label Studio Frontend sync'

on:
schedule:
# Every Monday at 0400 UTC (before sync to release branch).
- cron: '0 4 * * 1'
workflow_call:
workflow_dispatch:
Expand All @@ -12,10 +13,13 @@ jobs:
steps:
- uses: hmarr/[email protected]

- name: Checkout
uses: actions/checkout@v4

- name: Create dispatch event
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GIT_PAT }}
github-token: ${{ secrets.KHAN_ACTIONS_BOT_TOKEN }}
script: |
const { repo, owner } = context.repo;
Expand All @@ -38,11 +42,11 @@ jobs:
repo,
event_type: 'upstream_repo_update',
client_payload: {
branch_name: 'fb-scheduled-lsf-sync',
branch_name: 'develop',
base_branch_name: lsf_repo_data.default_branch,
repo_name: lsf_repo_data.full_name,
commit_sha: lsf_commit.sha,
title: "feat: Scheduled LSF sync",
title: "Scheduled Label Studio Frontend sync",
html_url: lsf_commit.html_url,
actor: lsf_commit.commit.author.name,
author_username: lsf_commit.commit.author.name,
Expand All @@ -51,3 +55,8 @@ jobs:
}
});
return result
- name: Notify Slack on failure
if: failure()
uses: ./.github/actions/notify_slack
with:
webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
Loading

0 comments on commit 695ea6d

Please sign in to comment.