Show Pull Request Change Note #24
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Show Pull Request Change Note | |
run-name: Show Pull Request Change Note | |
on: | |
pull_request: | |
types: [opened, edited] | |
jobs: | |
show-pull-request-change-note: | |
name: Show Pull Request Change Note | |
runs-on: ubuntu-latest | |
env: | |
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} | |
# secrets.GITHUB_TOKEN is automatically generated by GitHub for each workflow run | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Copy this repository to the Linux runner | |
uses: actions/checkout@v4 | |
- name: Install libcurl | |
run: sudo apt install libcurl4-openssl-dev | |
- name: Download nlohmann json.hpp header file | |
run: wget https://raw.githubusercontent.com/nlohmann/json/develop/single_include/nlohmann/json.hpp | |
- name: Build the script | |
run: g++ -o release_notes_generator Main.cpp Config.cpp Utils.cpp Format.cpp -lcurl -I. | |
- name: Run script to generate pull request change note | |
env: | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
run: ./release_notes_generator single_pr "$PULL_REQUEST_NUMBER" "$GH_TOKEN" "$GITHUB_REPOSITORY" | |
- name: Set extra comment message based on the trigger event type | |
id: set-extra-message | |
env: | |
TRIGGER_EVENT: ${{ github.event.action }} | |
run: | | |
if [ "$TRIGGER_EVENT" = "opened" ]; then | |
echo "COMMENT_TEXT=Thank you for contributing!<br>Below is how your contribution will look like in Synfig's release notes, review it and improve your pull request's title and description so that your contribution is clear, you can add images, videos and anything you want, have fun!<br>" >> "$GITHUB_OUTPUT" | |
elif [ "$TRIGGER_EVENT" = "edited" ]; then | |
echo "COMMENT_TEXT=Thank you for trying to improve your contribution description!<br>Below is how your updated contribution will look like in Synfig's release notes, review it and improve it till you are satisfied!<br>" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Comment in the pull request with the generated change note and extra message | |
env: | |
COMMENT_TEXT: ${{ steps.set-extra-message.outputs.COMMENT_TEXT }} | |
run: gh pr comment "$PULL_REQUEST_NUMBER" --body "$COMMENT_TEXT$(cat release_notes.md)" |