openrewrite / openrewrite/rewrite-github-actions

Remove `image` when the container block is empty

Open
#78 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

recipe
Dominant language
Java
Stars
1
Forks
9
Avg merge
5h 27m
Merged PRs (30d)
12

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the GitHub Actions container syntax in the linked documentation and compare the two YAML forms shown in the issue. Trace the repository's handling of container blocks, preserving the block when other configuration exists. Done means an empty container block is reduced to its image value while configured blocks remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, java
Domain
ci-cd, devops
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.