Skip to content

Commit d3bc853

Browse files
committed
fix(ci): build matrix value dynamically based on optional dispatch input
1 parent 8a57538 commit d3bc853

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

.github/workflows/update-dependencies.yaml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,29 @@ permissions:
2222
contents: none # We use the github app token to push the changes
2323

2424
jobs:
25+
configure_matrix:
26+
name: Configure matrix
27+
runs-on: ubuntu-latest
28+
outputs:
29+
group_name: ${{ steps.groups.outputs.group_name }}
30+
steps:
31+
- id: groups
32+
name: Define groups to update
33+
run: |
34+
echo "Configuring matrix (inputs.group_name=${{ inputs.group_name }})"
35+
if [[ ${{ inputs.group_name == '' || inputs.group_name == 'all' }} ]]; then
36+
# When adding new group, don't forget to update the `workflow_dispatch`
37+
echo 'group_name=["electron","eslint","typescript","mongosh"]' >> "$GITHUB_OUTPUT"
38+
else
39+
echo 'group_name=["${{ inputs.group_name }}"]' >> "$GITHUB_OUTPUT"
40+
fi
2541
update_dependencies_group:
2642
name: Update ${{ matrix.group_name }} to latest
2743
runs-on: ubuntu-latest
44+
needs: configure_matrix
2845
strategy:
2946
matrix:
30-
group_name:
31-
# When adding new group, don't forget to update the
32-
# `workflow_dispatch.inputs`
33-
- electron
34-
- eslint
35-
- typescript
36-
- mongosh
37-
if: ${{ inputs.group_name == '' || inputs.group_name == 'all' || inputs.group_name == matrix.group_name }}
47+
group_name: ${{ fromJSON(needs.configure_matrix.outputs.group_name) }}
3848
steps:
3949
- name: Create Github App Token
4050
uses: mongodb-js/devtools-shared/actions/setup-bot-token@main

0 commit comments

Comments
 (0)