-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
331 additions
and
146 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: "Update Feature Flags" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
required: true | ||
type: string | ||
workflow_dispatch: | ||
inputs: | ||
ref: | ||
description: "Ref" | ||
required: true | ||
type: string | ||
|
||
env: | ||
LAUNCHDARKLY_DOWNLOAD_PATH: "label_studio/feature_flags.json" | ||
FEATURE_FLAGS_COMMIT_MESSAGE: "ci: Update Feature Flags" | ||
|
||
jobs: | ||
commit-feature-flags: | ||
name: "Commit Feature Flags" | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: hmarr/[email protected] | ||
|
||
- name: Configure git | ||
shell: bash | ||
run: | | ||
set -xeuo pipefail | ||
git config --global user.name 'robot-ci-heartex' | ||
git config --global user.email '[email protected]' | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Download feature flags | ||
env: | ||
LAUNCHDARKLY_COMMUNITY_SDK_KEY: ${{ secrets.LAUNCHDARKLY_COMMUNITY_SDK_KEY }} | ||
run: | | ||
set -xeuo pipefail | ||
curl \ | ||
--connect-timeout 30 \ | ||
--retry 5 \ | ||
--retry-delay 10 \ | ||
-H "Authorization: $LAUNCHDARKLY_COMMUNITY_SDK_KEY" \ | ||
"https://sdk.launchdarkly.com/sdk/latest-all" | jq >"${{ env.LAUNCHDARKLY_DOWNLOAD_PATH }}" | ||
if [ "$(jq 'has("flags")' <<< cat ${{ env.LAUNCHDARKLY_DOWNLOAD_PATH }})" = "true" ]; then | ||
echo "feature_flags.json is valid" | ||
else | ||
echo "feature_flags.json is invalid" | ||
cat ${{ env.LAUNCHDARKLY_DOWNLOAD_PATH }} | ||
exit 1 | ||
fi | ||
- name: Commit and Push | ||
run: | | ||
git add "${{ env.LAUNCHDARKLY_DOWNLOAD_PATH }}" | ||
git status -s | ||
git commit -m '${{ env.FEATURE_FLAGS_COMMIT_MESSAGE }}' || true | ||
git push origin HEAD |
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,53 @@ | ||
name: 'Follow Merge: LSF Sync' | ||
|
||
on: | ||
schedule: | ||
- cron: '0 4 * * 1' | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
dispatch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: hmarr/[email protected] | ||
|
||
- name: Create dispatch event | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GIT_PAT }} | ||
script: | | ||
const { repo, owner } = context.repo; | ||
const lsf_owner = 'heartexlabs'; | ||
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: 'fb-scheduled-lsf-sync', | ||
base_branch_name: lsf_repo_data.default_branch, | ||
repo_name: lsf_repo_data.full_name, | ||
commit_sha: lsf_commit.sha, | ||
title: lsf_commit.commit.message.split('\n')[0], | ||
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 |
2 changes: 1 addition & 1 deletion
2
.github/workflows/sync-pr.yml → .github/workflows/follow-merge-sync-pr.yml
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Sync PR | ||
name: 'Follow Merge: Sync PR' | ||
|
||
on: | ||
pull_request_target: | ||
|
Oops, something went wrong.