workflows/merge-group: refactor prepare step to github-script
Less Bash, more JavaScript - it's policy!
This commit is contained in:
29
.github/workflows/merge-group.yml
vendored
29
.github/workflows/merge-group.yml
vendored
@@ -23,7 +23,9 @@ jobs:
|
|||||||
prepare:
|
prepare:
|
||||||
runs-on: ubuntu-24.04-arm
|
runs-on: ubuntu-24.04-arm
|
||||||
outputs:
|
outputs:
|
||||||
systems: ${{ steps.systems.outputs.systems }}
|
mergedSha: ${{ steps.prepare.outputs.mergedSha }}
|
||||||
|
targetSha: ${{ steps.prepare.outputs.targetSha }}
|
||||||
|
systems: ${{ steps.prepare.outputs.systems }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
with:
|
with:
|
||||||
@@ -31,19 +33,28 @@ jobs:
|
|||||||
sparse-checkout: |
|
sparse-checkout: |
|
||||||
ci/supportedSystems.json
|
ci/supportedSystems.json
|
||||||
|
|
||||||
- name: Load supported systems
|
- id: prepare
|
||||||
id: systems
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||||
run: |
|
env:
|
||||||
echo "systems=$(jq -c <ci/supportedSystems.json)" >> "$GITHUB_OUTPUT"
|
MERGED_SHA: ${{ inputs.mergedSha }}
|
||||||
|
TARGET_SHA: ${{ inputs.targetSha }}
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
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'))
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
name: Lint
|
name: Lint
|
||||||
|
needs: [prepare]
|
||||||
uses: ./.github/workflows/lint.yml
|
uses: ./.github/workflows/lint.yml
|
||||||
secrets:
|
secrets:
|
||||||
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||||
with:
|
with:
|
||||||
mergedSha: ${{ inputs.mergedSha || github.event.merge_group.head_sha }}
|
mergedSha: ${{ needs.prepare.outputs.mergedSha }}
|
||||||
targetSha: ${{ inputs.targetSha || github.event.merge_group.base_sha }}
|
targetSha: ${{ needs.prepare.outputs.targetSha }}
|
||||||
|
|
||||||
eval:
|
eval:
|
||||||
name: Eval
|
name: Eval
|
||||||
@@ -58,8 +69,8 @@ jobs:
|
|||||||
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||||
with:
|
with:
|
||||||
artifact-prefix: ${{ inputs.artifact-prefix }}
|
artifact-prefix: ${{ inputs.artifact-prefix }}
|
||||||
mergedSha: ${{ inputs.mergedSha || github.event.merge_group.head_sha }}
|
mergedSha: ${{ needs.prepare.outputs.mergedSha }}
|
||||||
targetSha: ${{ inputs.targetSha || github.event.merge_group.base_sha }}
|
targetSha: ${{ needs.prepare.outputs.targetSha }}
|
||||||
systems: ${{ needs.prepare.outputs.systems }}
|
systems: ${{ needs.prepare.outputs.systems }}
|
||||||
|
|
||||||
# This job's only purpose is to create the target for the "Required Status Checks" branch ruleset.
|
# This job's only purpose is to create the target for the "Required Status Checks" branch ruleset.
|
||||||
|
|||||||
Reference in New Issue
Block a user