Unverified Commit 957de226 authored by Michael Daniels's avatar Michael Daniels Committed by GitHub
Browse files

ci: get supported systems from the target branch (#493997)

parents b0405e5e fcb9bf6c
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -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
+3 −1
Original line number Diff line number Diff line
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 −0
Original line number Diff line number Diff line
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())
}

ci/supportedSystems.json

deleted100644 → 0
+0 −6
Original line number Diff line number Diff line
[
  "aarch64-linux",
  "aarch64-darwin",
  "x86_64-linux",
  "x86_64-darwin"
]