Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix diff on master #718

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Staged images 1 GitHub workflow (#1)
* feat: add new workflows

* remove: old workflow

* feat: update makefile to support new workflow
EveningStarlight authored Dec 30, 2024

Verified

This commit was signed with the committer’s verified signature.
jnatten Jonas Natten
commit fe64202fe6af9939bd675abaa2aa91f2a05779c8
247 changes: 0 additions & 247 deletions .github/workflows/build_push.yaml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/check-diff.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Check for changes in subdirectory

on:
workflow_call:
inputs:
directory:
description: The directory of the image files
required: true
type: string
outputs:
is-diff:
description: Is there a difference between the master branch and the current branch
value: ${{ jobs.check-diff.outputs.is-diff }}

jobs:
check-diff:
runs-on: ubuntu-latest
outputs:
is-diff: ${{ steps.check-changes.outputs.is-diff }}

steps:
- uses: actions/checkout@v4

- name: Fetch master branch
run: |
git fetch origin staged-builds-revised-stages:staged-builds-revised-stages # TODO staged-builds-revised-stages:staged-builds-revised-stages to master:master

- name: Check for changes
id: check-changes
run: | # Check for changes excluding README.md
# Check if the subdirectory exists in the base branch
if ! git ls-tree -d origin/staged-builds-revised-stages -- "images/${{ inputs.directory }}" >/dev/null 2>&1; then
echo "Subdirectory does not exist in the base branch"
echo "is-diff='true'" >> $GITHUB_OUTPUT
else
CHANGES=$(git diff --name-only origin/staged-builds-revised-stages HEAD -- "images/${{ inputs.directory }}" | grep -v "README.md" || true)
NEW_FILES=$(git diff --name-only --diff-filter=A origin/staged-builds-revised-stages HEAD -- "images/${{ inputs.directory }}" | grep -v "README.md" || true)

CHANGES="${CHANGES}${NEW_FILES}"

if [ -n "$CHANGES" ]; then
echo "Changes detected (excluding README.md)"
echo "is-diff=true" >> $GITHUB_OUTPUT
else
echo "No changes detected"
echo "is-diff=false" >> $GITHUB_OUTPUT
fi
fi
Loading