chore(releasing): Automated changelog generation #22
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
# Changelog | |
# | |
# Validates that a changelog entry was added. | |
# Runs on PRs when: | |
# - opened/re-opened | |
# - new commits pushed | |
# - label is added or removed | |
name: Changelog | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, labeled, unlabeled] | |
jobs: | |
check-changelog: | |
env: | |
PR_HAS_LABEL: ${{ contains( github.event.pull_request.labels.*.name, 'no-changelog') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Generate authentication token | |
id: generate_token | |
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a | |
with: | |
app_id: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_ID }} | |
private_key: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_PRIVATE_KEY }} | |
- name: Get PR comment author | |
id: author | |
uses: tspascoal/get-user-teams-membership@v3 | |
with: | |
username: ${{ github.actor }} | |
team: 'Vector' | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
- env: | |
AUTHOR_IS_TEAM_MEMBER: ${{ steps.author.outputs.isTeamMember }} | |
run: | | |
if [[ $PR_HAS_LABEL == 'true' ]] ; then | |
echo "'no-changelog' label detected." | |
exit 0 | |
fi | |
# helper script needs to reference the master branch to compare against | |
git fetch origin master:refs/remotes/origin/master | |
# If the PR author is an external contributor, validate that the | |
# changelog fragments added contain the author line for website rendering. | |
args="" | |
if [[ $AUTHOR_IS_TEAM_MEMBER != 'true' ]] ; then | |
echo "PR author detected to be an external contributor." | |
args="--author" | |
fi | |
./scripts/check_changelog_fragments.sh ${args} |