openrewrite / rewrite-github-actions

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

Replace action but leave configuration as is #80

Open yeikel opened 1 year ago

yeikel commented 1 year ago

Define an action that replaces the uses keyword with a different value but leaves everything as is

Example


      - name: Cache Maven Download
        uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
        with:
         path: ~/.m2/wrapper/dists
         key: ${{ runner.os }}-maven-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
         restore-keys: ${{ runner.os }}-maven-installation-

      - name: Cache Maven Download
--    uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
++    uses: myOrg/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
        with:
         path: ~/.m2/wrapper/dists
         key: ${{ runner.os }}-maven-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
         restore-keys: ${{ runner.os }}-maven-installation-

The goal is to handle relocations

Example : https://github.com/marketplace/actions/retry-step#ownership