From aad894fa08a5db3890856ac21f506da68ffef26d Mon Sep 17 00:00:00 2001 From: Andrew Cassidy Date: Tue, 27 Aug 2024 22:27:24 -0700 Subject: [PATCH] Add body-file output, alias body_file to it --- .github/workflows/build.yml | 8 ++++---- action.yaml | 7 +++++-- docs/handbook/github_actions.md | 4 ++-- yaclog/cli/__main__.py | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 478c239..a355b5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,8 +45,8 @@ jobs: needs: test runs-on: ubuntu-22.04 outputs: - body_file: ${{ steps.yaclog-show.outputs.body_file }} - version_name: ${{ steps.yaclog-show.outputs.name }} + body-file: ${{ steps.yaclog-show.outputs.body-file }} + version-name: ${{ steps.yaclog-show.outputs.name }} steps: - uses: actions/checkout@v4 @@ -109,8 +109,8 @@ jobs: - name: Publish to Github run: > gh release create ${{ github.ref_name }} - --notes-file "${{ needs.build.outputs.body_file }}" - --title "${{ needs.build.outputs.version_name }}" + --notes-file "${{ needs.build.outputs.body-file }}" + --title "${{ needs.build.outputs.version-name }}" dist/* env: GH_TOKEN: ${{ github.token }} \ No newline at end of file diff --git a/action.yaml b/action.yaml index 2354990..13501d3 100644 --- a/action.yaml +++ b/action.yaml @@ -28,9 +28,12 @@ outputs: version: description: "The current version number. For example, `1.3.0`" value: ${{ steps.yaclog-show.outputs.version }} - body_file: + body-file: description: "Path to a temporary file containing the version body" - value: ${{ steps.yaclog-show.outputs.body_file }} + value: ${{ steps.yaclog-show.outputs.body-file }} + body_file: + description: "Alias for body-file" + value: ${{ steps.yaclog-show.outputs.body-file }} changelog: description: "Path to the entire changelog file." value: ${{ steps.yaclog-show.outputs.changelog }} diff --git a/docs/handbook/github_actions.md b/docs/handbook/github_actions.md index eafd899..d6ca462 100644 --- a/docs/handbook/github_actions.md +++ b/docs/handbook/github_actions.md @@ -46,7 +46,7 @@ The most recent version name, equivalent to the output of `yaclog show --name`. The entire header for the most recent version, equivalent to the output of `yaclog show --header`. For example, `Version 1.3.0 - 2024-08-08` ``` -```{confval} body_file +```{confval} body-file The path to a temporary file containing the body of the most recent version. Contents equivalent to `yaclog show --body` ``` @@ -82,7 +82,7 @@ jobs: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') run: | gh release create {{ '${{ github.ref_name }}' }} \ - --notes-file "{{ '${{ steps.yaclog.outputs.body_file }}' }}" \ + --notes-file "{{ '${{ steps.yaclog.outputs.body-file }}' }}" \ --title "{{ '${{ steps.yaclog.outputs.name }}' }}" env: GH_TOKEN: {{ '${{ github.token }}' }} diff --git a/yaclog/cli/__main__.py b/yaclog/cli/__main__.py index cc5635f..97ad445 100644 --- a/yaclog/cli/__main__.py +++ b/yaclog/cli/__main__.py @@ -123,7 +123,7 @@ def show(obj: Changelog, all_versions, markdown, mode, version_names, gh_actions body_fd, body_file = tempfile.mkstemp(text=True) with os.fdopen(body_fd, 'w') as f: f.write(sep.join([functions['body'](v, kwargs) for v in versions])) - click.echo(f'body_file={body_file}') + click.echo(f'body-file={body_file}') click.echo(f'changelog={obj.path}') return