Skip to content

Scheduled Label Studio Frontend sync #63

Scheduled Label Studio Frontend sync

Scheduled Label Studio Frontend sync #63

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:
jobs:
dispatch:
runs-on: ubuntu-latest
steps:
- uses: hmarr/[email protected]
- name: Checkout
uses: actions/checkout@v4
- name: Create dispatch event
uses: actions/github-script@v6
with:
github-token: ${{ secrets.KHAN_ACTIONS_BOT_TOKEN }}
script: |
const { repo, owner } = context.repo;
const lsf_owner = owner;
const lsf_repo = 'label-studio-frontend';
const {data: lsf_repo_data} = await github.rest.repos.get({
owner: lsf_owner,
repo: lsf_repo,
});
const {data: lsf_commit} = await github.rest.repos.getCommit({
owner: lsf_owner,
repo: lsf_repo,
ref: lsf_repo_data.default_branch
});
const result = await github.rest.repos.createDispatchEvent({
owner,
repo,
event_type: 'upstream_repo_update',
client_payload: {
branch_name: 'develop',
base_branch_name: lsf_repo_data.default_branch,
repo_name: lsf_repo_data.full_name,
commit_sha: lsf_commit.sha,
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,
author_email: lsf_commit.commit.author.email,
event_action: 'merged'
}
});
return result
- name: Notify Slack on failure
if: failure()
uses: ./.github/actions/notify_slack
with:
webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}