int128 / create-ecr-repository-action

Action to create Amazon ECR or ECR Public repository and put lifecycle policy
MIT License
18 stars 13 forks source link

lifecycle-policy file #1268

Open Bryan-Meier opened 4 months ago

Bryan-Meier commented 4 months ago

Is it or would it be possible to point to a file in another repo for the lifecycle-policy.json? Our situation is such that we have a repo with our workflow. This workflow is used by multiple other repos by way of workflow_call. Our lifecycle-policy.json file is in the repo that contains our shared workflow and thus we need to point to that file.

Thoughts or ideas are more than welcomed.

KelvinVenancio commented 3 months ago

@Bryan-Meier I believe this issue stems more from a limitation with GitHub rather than the action itself. We've encountered a similar situation with our reusable workflows. To address this, we utilize curl to fetch the policy file and then configure it across all repositories that implement these workflows. This method ensures consistency and compliance throughout our projects.

      - name: Download ECR Policy
        run: |
          curl -s -o lifecycle-policy.json https://pastebin.com/raw/YQxpnEKe

      - uses: int128/create-ecr-repository-action@v1
        with:
          repository: ${{ inputs.ECR_REPO_NAME }}
          lifecycle-policy: lifecycle-policy.json

I hope it helps you!