Skip to content

Feature request and use case example to allow matrix in ifs #25622

Answered by weide-zhou
MOZGIII asked this question in Actions
Discussion options

You must be logged in to vote

Hi @mozgiii,

Thanks for your reply!

Github support dynamic matrix value now. Based on your logic, you can add a prejob and set the matrix value accordingly(events&pr labels) , transfer the matrix value to your test job. In this case, you don’t need to cancel the redundant jobs.
Code sample as below(please change the matrix value for yours):

on:
  push: 
  pull_request: 
  schedule:
    - cron: "*/6 * * * *"

jobs:
prejob:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix1.outputs.matrix }}${{ steps.set-matrix2.outputs.matrix }} #get the matrix value and transfer to next job
steps:
- name: set matrix 1 # set the matrix value for push, schedule event and pr event with expected …

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants