Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 44 additions & 5 deletions .github/workflows/reusable_cross_repos_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ jobs:
let match;
let prs = [];
let patchUrls = [];
let fetched_prs = [];
let fetchedPrs = [];
while ((match = prRegex.exec(body)) !== null) {
let owner = match[1];
let repo = match[2];
let pr_num = match[3];
prs.push({owner: owner, repo: repo, pr_num: pr_num});
let prNo = match[3];
prs.push({owner: owner, repo: repo, pr_num: prNo});
patchUrls.push({repo: repo, url: match[0] + ".diff"});
}
// Get metadata of the PR.
Expand All @@ -58,7 +58,7 @@ jobs:
repo,
pull_number: pr_num,
});
fetched_prs.push({owner: owner, repo: repo, pr_num: pr_num, sha: pullRequest.head.sha});
fetchedPrs.push({owner: owner, repo: repo, pr_num: pr_num, sha: pullRequest.head.sha});
}));

// Download diffs.
Expand All @@ -70,7 +70,30 @@ jobs:
});
await fs.writeFile(patchFilename, response.data);
}));
core.setOutput('fetched_prs', JSON.stringify(fetched_prs));
core.setOutput('fetched_prs', JSON.stringify(fetchedPrs));

- name: Create Check in Dashboard
id: create_check
uses: actions/github-script@v6
with:
script: |
const fetchedPrs = JSON.parse('${{ steps.fetch_prs.outputs.fetched_prs }}');
let checks = [];
await Promise.all(fetchedPrs.map(async({owner, repo, sha }) => {
// FIXME: We're unable to create checks in other repos.
if (repo != context.repo.repo) {
return;
}
const resp = await github.rest.checks.create({
owner: owner,
repo: repo,
name: 'Build and test',
head_sha: sha,
status: 'in_progress',
});
checks.push({owner: owner, repo: repo, check_run_id: resp.data.id});
}));
core.setOutput('checks', JSON.stringify(checks));

- name: Download prebuilt Android repo
run: |
Expand Down Expand Up @@ -154,6 +177,22 @@ jobs:
run: |
./build/ci/run_ci.py

- name: Update Check in Dashboard
id: update_check
uses: actions/github-script@v6
with:
script: |
const checks = JSON.parse('${{ steps.create_check.outputs.checks }}');
await Promise.all(checks.map(async({owner, repo, check_run_id }) => {
await github.rest.checks.update({
owner: owner,
repo: repo,
check_run_id: check_run_id,
status: 'completed',
conclusion: '${{ job.status }}',
});
}));

- name: Notify job ended
if: always()
uses: actions/github-script@v8
Expand Down