openrewrite / rewrite-github-actions

OpenRewrite recipes for performing GitHub action hygiene and migration tasks.
Apache License 2.0
9 stars 9 forks source link

Recipe to update job triggers #90

Open yeikel opened 10 months ago

yeikel commented 10 months ago

Create a recipe to update the types for which a job can be triggered

Examples :

Input :


name: "My job"

on:
  pull_request:
    types:
      - opened
      - edited
      - synchronize

Remove entry

on:
  pull_request:
    types:
      - opened
      - edited
-      - synchronize

Add entry:

on:
  pull_request:
    types:
      - opened
      - edited
      - synchronize
+    - closed

Add new type:

on:
+  pull_request_review:
+    types: [edited, dismissed]
  pull_request:
    types:
      - opened
      - edited
      - synchronize

As there are many possible options here, we should probably have a generic recipe that accepts a yml expression and replaces the on block with it