Skip to content

Update Default Map

Update Default Map #1

name: Update Default Map
on:
workflow_dispatch:
schedule:
- cron: "0 2 * * 0" # Run every Sunday at 2 AM UTC
jobs:
update-map:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
coverage: "none"
- name: Install Composer dependencies
run: composer install --no-progress --ansi
- name: Update DefaultMap
id: update
continue-on-error: true
run: |
php ./bin/fileeye-mimemap update --ansi
- name: Check for changes
id: check
run: |
if git diff --quiet src/Map/DefaultMap.php; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.check.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v5
with:
commit-message: "Update DefaultMap"
title: "Update DefaultMap"
body: |
Automated update of the DefaultMap using the fileeye-mimemap utility.
This updates the MIME type to file extension mappings from the latest sources.
branch: update-default-map-${{ github.run_number }}
delete-branch: true