Skip to content

Commit

Permalink
allow passing-in ocm-repositories for release-notes action
Browse files Browse the repository at this point in the history
  • Loading branch information
ccwienk committed Jan 17, 2025
1 parent e3e323e commit 21cc579
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
17 changes: 16 additions & 1 deletion .github/actions/release-notes/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ inputs:
as output by `base-component-descriptor` workflow. Its version must be set to next planned
version (e.g. `1.2.0-dev`, if greatest released version was `1.1.0`).
required: true
ocm-repositories:
description: |
a (commaseparated) list of ocm-repository-URLs where component-versions are to be looked up
(order is honoured).
Caveat: this action will only honour final versions. Hence, at least one ocm-repository
containing final/release versions must be passed.
If no ocm-repository is passed, this action will fallback to the current ocm-repository from
passed ocm-component-descriptor (see caveat above).
github-token:
description: |
the github-auth-token to use for authenticating against GitHub.
Expand Down Expand Up @@ -62,11 +72,16 @@ runs:
draft_arg='--draft'
fi
if [ -n "${{ inputs.ocm-repositories }}" ]; then
ocm_repositories_arg="--ocm-repositories ${{ inputs.ocm-repositories }}"
fi
echo 'Fetching release-notes'
"${GITHUB_ACTION_PATH}/release_notes_cli.py" \
--component-descriptor component-descriptor.yaml \
--github-auth-token "${auth_token}" \
${draft_arg:-} \
${draft_arg:-} \
${ocm_repositories_arg:-} \
--outfile release-notes.md
echo 'Release-notes written to `release-notes.md`'
Expand Down
11 changes: 10 additions & 1 deletion .github/actions/release-notes/release_notes_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ def main():
default='component-descriptor.yaml',
help='path to component-descriptor file to read from',
)
parser.add_argument(
'--ocm-repositories',
action='extend',
type=lambda repo: repo.split(','),
default=[],
)
parser.add_argument(
'--repo-url',
required=False,
Expand Down Expand Up @@ -92,7 +98,10 @@ def main():
oci_client = oci.client.Client(
credentials_lookup=oci.auth.docker_credentials_lookup(),
)
ocm_repository_lookup = cnudie.retrieve.ocm_repository_lookup(component.current_ocm_repo)
ocm_repository_lookup = cnudie.retrieve.ocm_repository_lookup(
*parsed.ocm_repositories,
component.current_ocm_repo,
)

component_descriptor_lookup = cnudie.retrieve.create_default_component_descriptor_lookup(
ocm_repository_lookup=ocm_repository_lookup,
Expand Down

0 comments on commit 21cc579

Please sign in to comment.