Bump eslint from 8.47.0 to 8.48.0 (#215) #120
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
# 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@v3 | |
- 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: 16 | |
- name: Install dependencies | |
run: npm ci | |
- name: Rebuild the dist/ directory | |
run: npm run prepare | |
- 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 dist && git commit -m 'Updated dist' && git push origin main |