mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-23 08:02:15 -05:00
perf(action): Limit checked files to those changed
This commit is contained in:
parent
bed511b57a
commit
fc7f517466
2 changed files with 10 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
FROM ubuntu:20.04
|
FROM ubuntu:20.04
|
||||||
ARG VERSION=1.9.0
|
ARG VERSION=1.9.0
|
||||||
ENV VERSION=${VERSION}
|
ENV VERSION=${VERSION}
|
||||||
RUN apt-get update && apt-get install -y wget
|
RUN apt-get update && apt-get install -y wget git
|
||||||
RUN wget https://github.com/crate-ci/typos/releases/download/v${VERSION}/typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz && \
|
RUN wget https://github.com/crate-ci/typos/releases/download/v${VERSION}/typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz && \
|
||||||
tar -xzvf typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz && \
|
tar -xzvf typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz && \
|
||||||
mv typos /usr/local/bin
|
mv typos /usr/local/bin
|
||||||
|
|
|
@ -8,6 +8,15 @@ log() {
|
||||||
|
|
||||||
CMD_NAME="typos"
|
CMD_NAME="typos"
|
||||||
TARGET=${INPUT_FILES:-"."}
|
TARGET=${INPUT_FILES:-"."}
|
||||||
|
if [[ -n "${GITHUB_BASE_REF:-}" ]]; then
|
||||||
|
git config --global --add safe.directory /github/workspace
|
||||||
|
if git rev-parse --verify master 2>/dev/null ; then
|
||||||
|
log "Limiting checks to ${GITHUB_BASE_REF}...HEAD"
|
||||||
|
TARGET=$(git diff ${GITHUB_BASE_REF}...HEAD --name-only --diff-filter=AM -- ${TARGET})
|
||||||
|
else
|
||||||
|
log "WARN: Not limiting checks to ${GITHUB_BASE_REF}...HEAD, ${GITHUB_BASE_REF} is not available"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z $(ls ${TARGET} 2>/dev/null) ]]; then
|
if [[ -z $(ls ${TARGET} 2>/dev/null) ]]; then
|
||||||
log "ERROR: Input files (${TARGET}) not found"
|
log "ERROR: Input files (${TARGET}) not found"
|
||||||
|
|
Loading…
Reference in a new issue