openrewrite / rewrite-github-actions

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

Remove `image` when the container block is empty #78

Open yeikel opened 1 year ago

yeikel commented 1 year ago

From: https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container


jobs:
  container-test-job:
    runs-on: ubuntu-latest
    container:
      image: node:14.16     

jobs:
  container-test-job:
    runs-on: ubuntu-latest
    container: node:14.16

If there is more configuration within the container block, it should stay as is. Example:


jobs:
  container-test-job:
    runs-on: ubuntu-latest
    container:
      image: node:14.16
      env:
        NODE_ENV: development
      ports:
        - 80
      volumes:
        - my_docker_volume:/volume_mount
      options: --cpus 1
    steps:
      - name: Check for dockerenv file
        run: (ls /.dockerenv && echo Found dockerenv) || (echo No dockerenv)