Update Dependencies #3
This file contains hidden or 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: Check for ExifTool Updates | |
| on: | |
| schedule: | |
| - cron: '0 6 * * MON' # Run every Monday at 6 AM UTC | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| check-updates: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Update dependencies | |
| id: update | |
| run: | | |
| # Capture current package.json content | |
| cp package.json package.json.backup | |
| # Run npm-check-updates to update all dependencies | |
| npx ncu -u | |
| # Check if package.json was modified | |
| if ! diff -q package.json package.json.backup > /dev/null; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "Dependencies updated" | |
| # Generate summary of changes | |
| { | |
| echo 'update_summary<<EOF' | |
| echo "Updated dependencies to their latest versions:" | |
| echo "" | |
| # Show the diff in a readable format | |
| diff -u package.json.backup package.json | grep "^[-+]" | grep -E "(exiftool-vendored|dependencies)" | sed 's/^-/ - /' | sed 's/^+/ + /' | |
| echo 'EOF' | |
| } >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| echo "No updates available" | |
| fi | |
| # Clean up backup | |
| rm -f package.json.backup | |
| - name: Install updated dependencies | |
| if: steps.update.outputs.changed == 'true' | |
| run: npm install | |
| - name: Run tests | |
| if: steps.update.outputs.changed == 'true' | |
| run: npm test | |
| - name: Create Pull Request | |
| if: steps.update.outputs.changed == 'true' | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| sign-commits: true | |
| commit-message: "chore(deps): update dependencies" | |
| title: "Update dependencies" | |
| body: | | |
| Updates dependencies to their latest versions. | |
| This is an automated update created by the check-updates workflow. | |
| ## Changes | |
| ${{ steps.update.outputs.update_summary }} | |
| ## Testing | |
| - ✅ Tests passed successfully | |
| ## Next Steps | |
| After merging this PR, consider creating a new release to publish the updated dependencies. | |
| Please review the changes and merge if everything looks good. | |
| branch: update-exiftool-deps | |
| delete-branch: true | |
| labels: | | |
| dependencies | |
| automated |