Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 7a4bcfb

Browse files
ci: SRE-541: Dynamic GH org name (#1462)
1 parent cc44fcc commit 7a4bcfb

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

.github/workflows/sync-pr-ls.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ concurrency:
1616
group: ${{ github.workflow }}-${{ github.head_ref }}
1717

1818
env:
19-
DOWNSTREAM_REPO_OWNER: heartexlabs
2019
DOWNSTREAM_REPO: label-studio
2120

2221
jobs:
@@ -35,26 +34,27 @@ jobs:
3534
with:
3635
github-token: ${{ secrets.GIT_PAT }}
3736
script: |
38-
const [owner, repo] = '${{ github.event.pull_request.head.repo.full_name || github.repository }}'.split('/');
37+
const { repo, owner } = context.repo;
38+
const [pr_owner, pr_repo] = '${{ github.event.pull_request.head.repo.full_name || github.repository }}'.split('/');
3939
let event_action = '${{ github.event.action }}'
4040
let commit_sha = '${{ github.event.pull_request.head.sha }}'
4141
if (${{ github.event.pull_request.merged }}) {
4242
event_action = 'merged'
4343
commit_sha = '${{ github.sha }}'
4444
}
4545
const getCommitResponse = await github.rest.repos.getCommit({
46-
owner,
47-
repo,
46+
pr_owner,
47+
pr_repo,
4848
ref: commit_sha
4949
});
5050
const result = await github.rest.repos.createDispatchEvent({
51-
owner: '${{ env.DOWNSTREAM_REPO_OWNER }}',
51+
owner: owner,
5252
repo: '${{ env.DOWNSTREAM_REPO }}',
5353
event_type: 'upstream_repo_update',
5454
client_payload: {
5555
branch_name: '${{ github.head_ref }}',
5656
base_branch_name: '${{ github.base_ref }}',
57-
repo_name: '${{ github.event.pull_request.head.repo.full_name || github.repository }}',
57+
repo_name: '${{ github.repository }}',
5858
commit_sha : commit_sha,
5959
title: process.env.TITLE,
6060
html_url: '${{ github.event.pull_request.html_url }}',

.github/workflows/sync-pr-lse.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ concurrency:
1616
group: ${{ github.workflow }}-${{ github.head_ref }}
1717

1818
env:
19-
DOWNSTREAM_REPO_OWNER: heartexlabs
2019
DOWNSTREAM_REPO: label-studio-enterprise
2120

2221
jobs:
@@ -33,9 +32,10 @@ jobs:
3332
with:
3433
github-token: ${{ secrets.GIT_PAT }}
3534
script: |
35+
const { repo, owner } = context.repo;
3636
try {
3737
return (await github.rest.orgs.getMembershipForUser({
38-
org: '${{ env.DOWNSTREAM_REPO_OWNER }}',
38+
org: owner,
3939
username: '${{ github.actor }}',
4040
}))?.data?.state == "active";
4141
} catch (error) {
@@ -56,7 +56,7 @@ jobs:
5656
body: [
5757
'Hi @${{ github.actor }}!',
5858
'',
59-
'Unfortunately you don\'t have membership in ${{ env.DOWNSTREAM_REPO_OWNER }} organization, your PR wasn\'t synced with ${{ env.DOWNSTREAM_REPO }}.'
59+
`Unfortunately you don't have membership in ${owner} organization, your PR wasn't synced with ${owner}/${{ env.DOWNSTREAM_REPO }}.`
6060
].join('\n')
6161
});
6262
@@ -70,19 +70,20 @@ jobs:
7070
github-token: ${{ secrets.GIT_PAT }}
7171
script: |
7272
const { repo, owner } = context.repo;
73+
const [pr_owner, pr_repo] = '${{ github.event.pull_request.head.repo.full_name || github.repository }}'.split('/');
7374
let event_action = '${{ github.event.action }}'
7475
let commit_sha = '${{ github.event.pull_request.head.sha }}'
7576
if (${{ github.event.pull_request.merged }}) {
7677
event_action = 'merged'
7778
commit_sha = '${{ github.sha }}'
7879
}
7980
const getCommitResponse = await github.rest.repos.getCommit({
80-
owner,
81-
repo,
81+
pr_owner,
82+
pr_repo,
8283
ref: commit_sha
8384
});
8485
const result = await github.rest.repos.createDispatchEvent({
85-
owner: '${{ env.DOWNSTREAM_REPO_OWNER }}',
86+
owner: owner,
8687
repo: '${{ env.DOWNSTREAM_REPO }}',
8788
event_type: 'upstream_repo_update',
8889
client_payload: {

0 commit comments

Comments
 (0)