Skip to content

Commit

Permalink
chore(action): fix multiline rendering
Browse files Browse the repository at this point in the history
and add a PR action to see what is going on in the changelog
  • Loading branch information
Anis Campos committed Oct 13, 2022
1 parent 2cb0ce3 commit 121a562
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/validate_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,40 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: lumapps/github-actions-validator@master
release_notes:
timeout-minutes: 30
name: Render the changelog in a PR comment
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get path filters
id: get_path_filters
run: |
service=${{ steps.get_version_and_tag.outputs.service }}
# those path focuses on relevant changes that can really impact a release
path_filters="changelog_generator/"
echo ::set-output name=path_filters::"$path_filters"
- name: Generate changelog
id: generate_changelog
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
path_filters: ${{ steps.get_path_filters.outputs.path_filters }}
- uses: kanga333/comment-hider@bbdf5b562fbec24e6f60572d8f712017428b92e0
name: Hide previous comments
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Add PR Comment
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.CHANGELOG
})
13 changes: 9 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ outputs:
runs:
using: "composite"
steps:
- name: Install Python ${{ env.python-version }}
uses: actions/setup-python@v4
with:
python-version: '3.7'
cache: 'pip'
- name: Generate
id: generate
run: |
# install de dependencies
sudo apt-get install python3-wheel -y
pip3 install -r ${{ github.action_path }}/requirements.txt
# define the environment variables
Expand All @@ -49,14 +53,15 @@ runs:
# generate the change log
CHANGELOG=$(python3 -m changelog_generator \
--tag_prefix ${{ inputs.tag_prefix }} \
--path_filters ${{ inputs.path_filters }} \
| tr '%' '%25' | tr '\n' '%0A' | tr '\r' '%0D'
--path_filters ${{ inputs.path_filters }}
)
# truncate the release note to not bloat the 65536 bytes max limit
CHANGELOG=${CHANGELOG:0:65200}
# output the changelog
echo "::set-output name=changelog::$CHANGELOG"
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
shell: bash

0 comments on commit 121a562

Please sign in to comment.