googleapis / release-please-action

automated releases based on conventional commits
Apache License 2.0
1.56k stars 200 forks source link

Feature Request: support fetching release-please-config.json from the file system #1017

Open zepeng811 opened 1 week ago

zepeng811 commented 1 week ago

Is your feature request related to a problem? Please describe. We are using shared workflow as an wrapper for the workflow for easy maintenance and upgrade. Back in v3 of the workflow, we can provide inputs with default values to the shared workflow, then the inputs can be modified per repository when necessary. Basically, we have a shared config with default settings and the option to modify during runtime:

- uses: googleapis/release-please-action@v3
   id: release
   with:
       default-branch: ${{ inputs.master_branch }}
       release-type: ${{ inputs.release_type }}
       package-name: ${{ github.event.repository.name }}
       include-v-in-tag: ${{ inputs.include_v_in_tag }}
       pull-request-title-pattern: ${{ inputs.pull_request_title_template }}
       path: ${{ inputs.path }}
       monorepo-tags: ${{ inputs.monorepo-tags }}

In v4, since all advanced configurations now require a config file, we are trying to dynamically generate the config file during runtime, with the above configurations roughly converted to:

     - name: Prepare release-please-config.json
        id: prepare-config
        run: |
          cat > release-please-config.json <<EOL
          {
            "\$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
            "release-type": "${{ inputs.release_type }}",
            "pull-request-title-pattern": "${{ inputs.pull_request_title_template) }}",
            "include-v-in-tag": ${{ inputs.include_v_in_tag }},
            "include-component-in-tag": ${{ inputs.monorepo-tags }},
            "packages": {
              "${{ inputs.path }}": {
                "package-name": "${{ github.event.repository.name }}"
              }
            }
          }
          EOL

      - uses: googleapis/release-please-action@v4
         id: release
         with:
           target-branch: ${{ inputs.master_branch }}
           config-file: release-please-config.json

However, this does not work for v4, because the action is always trying to fetch the release-please-config.json file from the source repository and branch. The file in the file system will get ignored.

Run googleapis/release-please-action@v4
Running release-please version: 16.12.0
❯ Fetching release-please-config.json from branch release-please
❯ Fetching .release-please-manifest.json from branch release-please

(GitHub Actions logs showing the action is trying to fetch the .json files from the git repository and branch)

Describe the solution you'd like the config file can be fetched from the file system or the git source

Describe alternatives you've considered The only alternative is to add release-please-config.json to each repository we use the action, this will cause duplicate code and make the configurations difficult to maintain.