ci: get supported systems from the target branch

This commit is contained in:
Emily 2026-02-22 02:28:56 +00:00 committed by Michael Daniels
parent 227a519061
commit fcb9bf6c05
No known key found for this signature in database
4 changed files with 26 additions and 13 deletions

View file

@ -29,7 +29,7 @@ jobs:
with:
persist-credentials: false
sparse-checkout: |
ci/supportedSystems.json
ci/github-script/supportedSystems.js
- id: prepare
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
@ -39,6 +39,8 @@ jobs:
with:
script: |
const { classify } = require('./ci/supportedBranches.js')
const supportedSystems = require('./ci/github-script/supportedSystems.js')
const baseBranch = (
context.payload.merge_group?.base_ref ??
context.payload.pull_request.base.ref
@ -47,11 +49,16 @@ jobs:
core.setOutput('base', baseClassification)
core.info('base classification:', baseClassification)
core.setOutput('mergedSha', context.payload.merge_group?.head_sha ?? process.env.MERGED_SHA)
core.info(`mergedSha: ${context.payload.merge_group?.head_sha ?? process.env.MERGED_SHA}`)
core.setOutput('targetSha', context.payload.merge_group?.base_sha ?? process.env.TARGET_SHA)
core.info(`targetSha: ${context.payload.merge_group?.base_sha ?? process.env.TARGET_SHA}`)
core.setOutput('systems', require('./ci/supportedSystems.json'))
const mergedSha = context.payload.merge_group?.head_sha ?? process.env.MERGED_SHA
core.setOutput('mergedSha', mergedSha)
core.info(`mergedSha: ${mergedSha}`)
const targetSha = context.payload.merge_group?.base_sha ?? process.env.TARGET_SHA
core.setOutput('targetSha', targetSha)
core.info(`targetSha: ${targetSha}`)
const systems = await supportedSystems({ github, context, targetSha })
core.setOutput('systems', systems)
check:
name: Check

View file

@ -1,6 +1,7 @@
const { classify } = require('../supportedBranches.js')
const { postReview, dismissReviews } = require('./reviews.js')
const reviewKey = 'prepare'
const supportedSystems = require('./supportedSystems.js')
module.exports = async ({ github, context, core, dry }) => {
const pull_number = context.payload.pull_request.number
@ -209,7 +210,8 @@ module.exports = async ({ github, context, core, dry }) => {
core.setOutput('mergedSha', mergedSha)
core.setOutput('targetSha', targetSha)
core.setOutput('systems', require('../supportedSystems.json'))
const systems = await supportedSystems({ github, context, targetSha })
core.setOutput('systems', systems)
const files = (
await github.paginate(github.rest.pulls.listFiles, {

View file

@ -0,0 +1,10 @@
module.exports = async ({ github, context, targetSha }) => {
const { content, encoding } = (
await github.rest.repos.getContent({
...context.repo,
path: 'pkgs/top-level/release-supported-systems.json',
ref: targetSha,
})
).data
return JSON.parse(Buffer.from(content, encoding).toString())
}

View file

@ -1,6 +0,0 @@
[
"aarch64-linux",
"aarch64-darwin",
"x86_64-linux",
"x86_64-darwin"
]