Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Sep 26, 2024
1 parent eb5791c commit 8e26bbe
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,35 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check for code changes
id: check_changes
run: |
# 获取 24 小时前的时间戳
TWENTY_FOUR_HOURS_AGO=$(date -d '24 hours ago' '+%Y-%m-%d %H:%M:%S')
# 检查自 24 小时前以来是否有变更(排除.github 目录)
if git diff --quiet `git rev-list -n1 --before="$TWENTY_FOUR_HOURS_AGO" HEAD` HEAD -- ':!.github'; then
# 获取当前时间戳和 24 小时前的时间戳
CURRENT_TIMESTAMP=$(date +%s)
TWENTY_FOUR_HOURS_AGO_TIMESTAMP=$((CURRENT_TIMESTAMP - 86400))
echo "Current timestamp: $CURRENT_TIMESTAMP"
echo "24 hours ago timestamp: $TWENTY_FOUR_HOURS_AGO_TIMESTAMP"
echo "Commits in the last 24 hours:"
git log --since="@$TWENTY_FOUR_HOURS_AGO_TIMESTAMP" --format="%h %ct %s"
echo "All changed files in the last 24 hours (including .github):"
git diff --name-only $(git rev-list -n1 --before="@$TWENTY_FOUR_HOURS_AGO_TIMESTAMP" HEAD) HEAD
echo "Changed files excluding .github directory:"
CHANGED_FILES=$(git diff --name-only $(git rev-list -n1 --before="@$TWENTY_FOUR_HOURS_AGO_TIMESTAMP" HEAD) HEAD -- ':!.github')
if [ -z "$CHANGED_FILES" ]; then
echo "should_run=false" >> $GITHUB_OUTPUT
echo "No changes detected in the last 24 hours"
echo "No changes detected outside .github directory in the last 24 hours"
else
echo "should_run=true" >> $GITHUB_OUTPUT
echo "Changes detected in the last 24 hours"
echo "Changes detected outside .github directory in the last 24 hours:"
echo "$CHANGED_FILES"
fi
# 输出调试信息
echo "Current time: $(date '+%Y-%m-%d %H:%M:%S')"
echo "24 hours ago: $TWENTY_FOUR_HOURS_AGO"
echo "Commits in the last 24 hours:"
git log --since="24 hours ago" --oneline
echo "Files changed in the last 24 hours:"
git diff --name-only `git rev-list -n1 --before="$TWENTY_FOUR_HOURS_AGO" HEAD` HEAD -- ':!.github'
nightly-release:
needs: check_changes
if: needs.check_changes.outputs.should_run == 'true'
Expand Down

0 comments on commit 8e26bbe

Please sign in to comment.