I would like to use `--changed-since` in a GitHub ...
# general
t
I would like to use
--changed-since
in a GitHub Actions workflow to know if anything in Django has changed and use that to run subsequent steps conditionally. How can this be achieved best with
pants --changed-since=HEAD django::
?
Copy code
- name: Create list of changed docker images
        id: changed-since
        run: |
          pants --changed-since=HEAD --filter-target-type=docker_image list > changed_since.txt
          
      - name: Check for Changes in Django
        id: django-changed
        run: |
          grep -q "django" changed_since.txt && echo "any-changed=true" >> $GITHUB_OUTPUT || echo "any-changed=false" >> $GITHUB_OUTPUT
      - name: Conditional step
        if: steps.django-changed.outputs.any-changed == 'true'
Better ideas?
g
Not sure I understand what you're trying to do achieve, but would either of
--changed-dependees=transitive
and
--filter-address-regex='^django'
help you here?
t
I just would like to know if in my source root django any files have changed
g
Ok; and what's the relation to the docker images? 🙂 They seem to be tied together.
So for example
pants --changed-since=HEAD --filter-target-type=docker_image --filter-address-regex='^django/.*' --changed-dependees=transitive
should list: all docker images, where the address starts with
django/
, which have changed, or whose dependencies have changed, since the last commit.