File: get-changed-files.sh

package info (click to toggle)
adios2 2.10.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 33,764 kB
  • sloc: cpp: 175,964; ansic: 160,510; f90: 14,630; yacc: 12,668; python: 7,275; perl: 7,126; sh: 2,825; lisp: 1,106; xml: 1,049; makefile: 579; lex: 557
file content (33 lines) | stat: -rwxr-xr-x 872 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

case "${GITHUB_EVENT_NAME}"
in
  pull_request)
    BASE_SHA=$(jq -r .pull_request.base.sha "${GITHUB_EVENT_PATH}")
    HEAD_SHA=$(jq -r .pull_request.head.sha "${GITHUB_EVENT_PATH}")
    ;;
  push)
    BASE_SHA=$(jq -r .before "${GITHUB_EVENT_PATH}")
    HEAD_SHA=$(jq -r .after "${GITHUB_EVENT_PATH}")
    ;;
  *)
    echo "Unable to get changed files from '${GITHUB_EVENT_NAME}' event"
    exit 1
esac

echo "Event: ${GITHUB_EVENT_NAME}"
echo "Base: ${BASE_SHA}"
echo "Head: ${HEAD_SHA}"
echo ""

git fetch origin "${BASE_SHA}"

echo ""
echo "::group::All changed files"
git diff --name-only "${BASE_SHA}"..."${HEAD_SHA}" | tee all-changed-files.txt

echo "::group::Filtered changes"
grep -v '^docs/' all-changed-files.txt | tee filtered-changed-files.txt

echo "::group::Ignored changes"
grep '^docs/' all-changed-files.txt | tee ignored-changed-files.txt