How to "hoist" the "when" keyword from rule?

Replace this template with your information

I want to reuse my rules using the !reference tag but it seems that I can’t use the same rule in both some-job:rules: and workflow:rules: because the second one can’t recognize the on_success keyword.

I wanted to “hoist” the “when” keyword from the rules and define it after !reference to rule like this:

workflow:
  rules:
    - !reference [.my-rule, rules]
      when: always

some-job:
  rules:
    - !reference [.my-rule, rules]
      when: on_success

But GitLab CI doesn’t allow this:

Included file `.gitlab-ci/my-job.yml` does not have valid YAML syntax!

So the only way I see to handle it is duplicate entire rule set and change when: on_success to when: always:

.job-rules.yml:

.my-rule:
  rules:
    # Run pipeline only on MRs targeted develop
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_COMMIT_BRANCH != "develop"
      when: on_success

.workflow-rules.yml:

.my-workflow-rule:
  rules:
    # Run pipeline only on MRs targeted develop
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_COMMIT_BRANCH != "develop"
      when: always

But I really want to avoid such duplication. Is there any way to reuse the same rule for workflow:rules and job:rules: blocks?