Initalize changelog test workflow #2
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: Changelog Check | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
jobs: | |
changelog-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Check for CHANGELOG.md update | |
id: changelog-check | |
run: | | |
if ! grep -q "CHANGELOG.md" <<< "${{ github.event.pull_request.changed_files }}"; then | |
echo "Each PR must include an update to the CHANGELOG.md file." | |
# Add a comment to the PR | |
echo "::set-output name=comment::Each PR must include an update to the CHANGELOG.md file." | |
fi | |
- name: Comment on PR | |
uses: actions/github-script@v4 | |
if: steps.changelog-check.outputs.comment | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const core = require('@actions/core'); | |
const github = require('@actions/github'); | |
const comment = core.getInput('comment'); | |
github.issues.createComment({ | |
issue_number: github.context.issue.number, | |
owner: github.context.repo.owner, | |
repo: github.context.repo.repo, | |
body: comment | |
}); |