theme-store/.github/workflows/update-theme-date.yml
TheRealMG 6c30ab0b6a
Added rebase flag to Update Theme Timestamps action (#582)
* Update `updated at` field for `39907934-59e9-4e42-89f0-a254d3c5e280 ad97bb70-0066-4e42-9b5f-173a5e42c6fc bc25808c-a012-4c0d-ad9a-aa86be616019 `

* added rebase strategy to `Update Theme Timestamps` action

* added indent for proper json formatting

* added indent for proper formatting to `Rebuild Themes` as well

* Added indent for proper formatting to `Submit Theme`

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-18 12:54:17 +02:00

59 lines
1.6 KiB
YAML

name: Update Theme Timestamps
on:
push:
branches:
- main
paths:
- 'themes/**'
jobs:
update-timestamp:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 2
- name: Get changes
run: git diff --name-only HEAD^1 HEAD
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Detect changed themes
id: get_changes
run: |
changed_themes=$(git diff --name-only HEAD^1 HEAD | grep '^themes/' | awk -F/ '{print $2}' | sort -u | tr '\n' ' ')
echo "CHANGED_THEMES=$changed_themes" >> $GITHUB_ENV
- name: Setup python modules
run: |
pip3 install requests
- name: Setup Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Update theme date
if: env.CHANGED_THEMES != ''
run: |
for theme in $CHANGED_THEMES; do
python3 scripts/update_theme_date.py "themes/$theme"
done
- name: Commit changes
if: env.CHANGED_THEMES != ''
run: |
for theme in $CHANGED_THEMES; do
git add "themes/$theme/theme.json"
done
git commit -m "Update \`updated at\` field for \`$CHANGED_THEMES\`"
git pull origin main --rebase --strategy-option=theirs
git push origin main