This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
refactor: OPTIC-429: Remove unused FF ff_front_dev_1470_dm_pagination_010422_short #968
Workflow file for this run
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
name: 'Follow Merge: Sync PR LSO' | |
on: | |
pull_request_target: | |
types: | |
- opened | |
- closed | |
- converted_to_draft | |
- ready_for_review | |
- synchronize | |
branches: | |
- master | |
- 'ls-release/**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
env: | |
DOWNSTREAM_REPOSITORY: "label-studio" | |
DOWNSTREAM_EVENT_TYPE: "upstream_repo_update" | |
jobs: | |
sync: | |
name: "Sync" | |
if: startsWith(github.head_ref, 'fb-') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: hmarr/[email protected] | |
- name: Sync PR | |
uses: actions/github-script@v7 | |
id: sync-pr | |
env: | |
TITLE: ${{ github.event.pull_request.title }} | |
HEAD_REF: ${{ github.head_ref }} | |
BASE_REF: ${{ github.base_ref }} | |
PR_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name || github.repository }} | |
DOWNSTREAM_REPOSITORY: ${{ env.DOWNSTREAM_REPOSITORY }} | |
DOWNSTREAM_EVENT_TYPE: ${{ env.DOWNSTREAM_EVENT_TYPE }} | |
with: | |
github-token: ${{ secrets.GIT_PAT }} | |
script: | | |
const { repo, owner } = context.repo; | |
const pr_head_repository = process.env.PR_HEAD_REPOSITORY; | |
const downstream_repository = process.env.DOWNSTREAM_REPOSITORY; | |
const downstream_event_type = process.env.DOWNSTREAM_EVENT_TYPE; | |
const [pr_owner, pr_repo] = pr_head_repository.split('/'); | |
const head_ref = process.env.HEAD_REF; | |
const base_ref = process.env.BASE_REF; | |
let event_action = '${{ github.event.action }}'; | |
let commit_sha = '${{ github.event.pull_request.head.sha }}'; | |
if (${{ github.event.pull_request.merged }}) { | |
event_action = 'merged'; | |
commit_sha = '${{ github.sha }}'; | |
} | |
const getCommitResponse = await github.rest.repos.getCommit({ | |
owner: pr_owner, | |
repo: pr_repo, | |
ref: commit_sha | |
}); | |
const result = await github.rest.repos.createDispatchEvent({ | |
owner: owner, | |
repo: downstream_repository, | |
event_type: downstream_event_type, | |
client_payload: { | |
branch_name: head_ref, | |
base_branch_name: base_ref, | |
repo_name: '${{ github.repository }}', | |
commit_sha : commit_sha, | |
title: process.env.TITLE, | |
html_url: '${{ github.event.pull_request.html_url }}', | |
actor: '${{ github.actor }}', | |
author_username: getCommitResponse.data.commit.author.name, | |
author_email: getCommitResponse.data.commit.author.email, | |
event_action: event_action | |
} | |
}); | |
return result |