Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/update-default-map.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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
Loading