Skip to content

Commit

Permalink
Update check-updates.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mthcht authored Jun 13, 2024
1 parent 548285e commit cce5f36
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/check-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,36 @@ jobs:

- name: Add original repository as upstream
run: |
git remote add upstream https://github.com/EricZimmerman/KapeFiles
git remote add upstream https://github.com/EricZimmerman/KapeFiles || true
- name: Fetch updates from upstream
run: git fetch upstream
run: git fetch upstream || true

- name: Check for updates
id: check_updates
run: |
set -e
UPSTREAM_BRANCH=$(git branch -r | grep 'upstream/main' || true)
if [ -n "$UPSTREAM_BRANCH" ]; then
UPDATES=$(git log HEAD..upstream/main --oneline || true)
if [ -n "$UPDATES" ]; then
echo "updates=$UPDATES" >> $GITHUB_ENV
else
echo "updates=Up to date" >> $GITHUB_ENV
fi
else
echo "updates=Upstream branch not found" >> $GITHUB_ENV
- name: Debug - Show updates value
run: echo "Updates: ${{ env.updates }}"
echo "updates=" >> $GITHUB_ENV
fi
- name: Write updates to log
if: env(updates)
run: |
echo "Date: $(date +'%Y-%m-%d')" >> updates_log.txt
echo "Repository: ${{ github.repository }}" >> updates_log.txt
echo "Updates:" >> updates_log.txt
echo "${{ env.updates }}" >> updates_log.txt
echo "---" >> updates_log.txt
- name: Debug - Show log file content
run: cat updates_log.txt

- name: Commit and push changes
if: env(updates)
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
Expand Down

0 comments on commit cce5f36

Please sign in to comment.