Skip to content

Commit

Permalink
use include pattern to retain original ref
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Aug 14, 2024
1 parent 46c4ea8 commit d766c0a
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
init:
runs-on: ubuntu-24.04
outputs:
commits: ${{ steps.set.outputs.commits }}
includes: ${{ steps.set.outputs.includes }}
steps:
-
name: Checkout
Expand All @@ -27,21 +27,24 @@ jobs:
uses: actions/github-script@v7
with:
script: |
let commits = [];
await core.group(`Convert refs to commits`, async () => {
let includes = [];
await core.group(`Solve commit from ref`, async () => {
for (const ref of `${{ inputs.refs }}`.trim().split(/\r?\n/)) {
const commit = await github.rest.repos.getCommit({
owner: 'moby',
repo: 'buildkit',
ref: ref,
});
core.info(`${ref} -> ${commit.data.sha}`);
commits.push(commit.data.sha);
includes.push({
ref: ref,
commit: commit.data.sha,
});
}
});
await core.group(`Set commits matrix`, async () => {
core.info(JSON.stringify(commits, null, 2));
core.setOutput('commits', JSON.stringify(commits));
await core.group(`Set includes`, async () => {
core.info(JSON.stringify(includes, null, 2));
core.setOutput('includes', JSON.stringify(includes ?? []));
});
prepare:
Expand All @@ -51,7 +54,7 @@ jobs:
strategy:
fail-fast: false
matrix:
commit: ${{ fromJson(needs.init.outputs.commits) }}
include: ${{ fromJson(needs.init.outputs.includes) }}
steps:
-
name: Checkout
Expand All @@ -64,7 +67,7 @@ jobs:
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
buildkitd-flags: --debug
-
name: Build
name: Build ${{ matrix.ref }}
uses: docker/bake-action@v5
with:
targets: tests-base
Expand Down

0 comments on commit d766c0a

Please sign in to comment.