Skip to content

파괴적 혁신 기술 정의 포스트 업로드 #12

파괴적 혁신 기술 정의 포스트 업로드

파괴적 혁신 기술 정의 포스트 업로드 #12

Workflow file for this run

name: Stamp post dates
on:
push:
branches:
- main
paths:
- 'content/blog/**/*.md'
permissions:
contents: write
concurrency:
group: stamp-dates
cancel-in-progress: false
jobs:
stamp:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Determine added/modified blog files
id: diff
run: |
set -euo pipefail
BEFORE="${{ github.event.before }}"
AFTER="${{ github.sha }}"
ZERO="0000000000000000000000000000000000000000"
if [ -z "$BEFORE" ] || [ "$BEFORE" = "$ZERO" ]; then
echo "First push or unknown base; skipping."
ADDED=""
MODIFIED=""
else
ADDED=$(git diff --name-only --diff-filter=A "$BEFORE" "$AFTER" -- 'content/blog/**/*.md' || true)
MODIFIED=$(git diff --name-only --diff-filter=M "$BEFORE" "$AFTER" -- 'content/blog/**/*.md' || true)
fi
{
echo "added<<__EOF__"
echo "$ADDED"
echo "__EOF__"
echo "modified<<__EOF__"
echo "$MODIFIED"
echo "__EOF__"
} >> "$GITHUB_OUTPUT"
echo "Added:"
echo "$ADDED"
echo "Modified:"
echo "$MODIFIED"
- name: Set up Python
if: steps.diff.outputs.added != '' || steps.diff.outputs.modified != ''
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Stamp dates
id: stamp
if: steps.diff.outputs.added != '' || steps.diff.outputs.modified != ''
env:
ADDED_FILES: ${{ steps.diff.outputs.added }}
MODIFIED_FILES: ${{ steps.diff.outputs.modified }}
run: python .github/scripts/stamp_dates.py
- name: Commit and push
if: steps.stamp.outputs.changed == 'true'
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add content/blog
if git diff --cached --quiet; then
echo "No staged changes after stamping."
exit 0
fi
git commit -m "chore: stamp post dates [skip ci]"
git push origin HEAD:main