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 11c57a5 commit ba71d43
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/check-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,37 @@ 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
echo "updates=" >> $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
- name: Write updates to log
if: ${{ env.updates && env.updates != '' }}
run: |
echo "Date: $(date +'%Y-%m-%d')" > updates_log.txt
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 && 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 ba71d43

Please sign in to comment.