Directory.Build.props,Controls/Foldable: change details #80
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: Add changelog for Maestro bump | |
on: pull_request | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: | |
add-changelog: | |
name: Add changelog | |
runs-on: ubuntu-latest | |
if: github.actor == 'dotnet-maestro[bot]' | |
steps: | |
- name: 'Compute changelog' | |
run: | | |
set -exo pipefail | |
git clone https://github.com/spouliot/dotnet-tools | |
cd dotnet-tools/changelog | |
dotnet run https://github.com/$GITHUB_REPOSITORY/pull/${GITHUB_REF_NAME/\/*/} > changelog.txt 2>&1 | |
CHANGELOG_FILE=changelog2.txt | |
rm -f "$CHANGELOG_FILE" | |
cat changelog.txt | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\n/g' >> "$CHANGELOG_FILE" | |
cat "$CHANGELOG_FILE" | |
cp "$CHANGELOG_FILE" /tmp/changelog.txt | |
- name: 'Add changelog' | |
uses: actions/[email protected] | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const fs = require('fs'); | |
const changelog_message = fs.readFileSync('/tmp/changelog.txt', 'utf8'); | |
// check if we've already added a changelog to this PR, and if so, update that comment, otherwise add a new comment | |
var commentId = "" | |
await github.paginate (github.rest.issues.listComments, | |
{ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number | |
}).then ((comments) => | |
{ | |
const changelogComment = comments.find(comment => comment.body.includes (".net ChangeLog for") && comment.user.login == 'github-actions[bot]') | |
if (changelogComment) | |
commentId = changelogComment.id | |
}) | |
if (commentId == "") { | |
github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body: changelog_message | |
}) | |
} else { | |
github.rest.issues.updateComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
comment_id: commentId, | |
body: changelog_message | |
}) | |
} |