This action gives you access to the composer.json file content in form of environment variables.
- name: "Read Composer file"
id: "composer"
uses: "flagbit/[email protected]"
- name: "Get composer package name"
run: "echo ${{ env.composer_name }}"
Because composer package and namespace keys contain slashes and backslashes, they can't be translated into a valid env-name. In this case both will be replaced with dashes. For example:
- name: "Get Symfony package version constraint"
run: "echo ${{ env.composer_require_symfony-symfony }}"
In case you have your composer file in a different path than the project's root directory, you can set a path name to the correct composer path.
- name: "Read Composer file"
id: "composer"
uses: "flagbit/[email protected]"
with:
composer_file: "path/to/composer.json"
You don't know how the wanted key looks like? Enable debugging and all composer env-variables will be printed during a running workflow.
- name: "Read Composer file"
id: "composer"
uses: "flagbit/[email protected]"
with:
debug: "1"