mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-03-08 01:24:09 +01:00
ci: get supported systems from the target branch
This commit is contained in:
parent
227a519061
commit
fcb9bf6c05
4 changed files with 26 additions and 13 deletions
19
.github/workflows/merge-group.yml
vendored
19
.github/workflows/merge-group.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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, {
|
||||
|
|
|
|||
10
ci/github-script/supportedSystems.js
Normal file
10
ci/github-script/supportedSystems.js
Normal 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())
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[
|
||||
"aarch64-linux",
|
||||
"aarch64-darwin",
|
||||
"x86_64-linux",
|
||||
"x86_64-darwin"
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue