Skip to content

Add "@types/semver" as dev dependency #182

Add "@types/semver" as dev dependency

Add "@types/semver" as dev dependency #182

Workflow file for this run

# regenerates CHANGELOG.md and dist/index.js if necessary
#
# CHANGELOG.md is generated by https://github.com/github-changelog-generator/github-changelog-generator
# This job verifies, that it contains always the current content
# and also pushes the updated changelog to https://github.com/pmd/pmd-github-action/blob/main/CHANGELOG.md
#
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
# This job verifies, that it contains always the current content
# and also pushes the any necessary updates
name: Regenerate CHANGELOG and dist
on:
push:
branches:
- main
workflow_dispatch:
jobs:
regenerate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Run github_changelog_generator
shell: bash
run: |
bundle exec github_changelog_generator --token ${{ secrets.GITHUB_TOKEN }}
- name: Compare the expected and actual CHANGELOG.md
run: |
if [ "$(git diff CHANGELOG.md | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
echo "changelog=outdated" >> $GITHUB_ENV
else
echo "changelog=current" >> $GITHUB_ENV
fi
- name: Push changes to CHANGELOG.md
if: ${{ github.repository == 'pmd/pmd-github-action' && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && env.changelog == 'outdated' }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions (pmd-bot)"
git add CHANGELOG.md && git commit -m 'Updated CHANGELOG.md' && git push origin main
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Rebuild the dist/ directory
run: npm run package
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
echo "dist=outdated" >> $GITHUB_ENV
else
echo "dist=current" >> $GITHUB_ENV
fi
- name: Push changes to dist/
if: ${{ github.repository == 'pmd/pmd-github-action' && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && env.dist == 'outdated' }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions (pmd-bot)"
git add -f dist && git commit -m 'Updated dist' && git push origin main