mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-25 10:31:02 -05:00
feat(ci): Use composite to run action
Using composite instead of docker to avoid building image, it can make the action faster. If the `typos` command doesn't exist, download and extract it.
This commit is contained in:
parent
6add7347fc
commit
6855a78893
5 changed files with 18 additions and 17 deletions
14
action.yml
14
action.yml
|
@ -30,8 +30,18 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "docker"
|
using: 'composite'
|
||||||
image: "docker/Dockerfile"
|
steps:
|
||||||
|
- id: typos
|
||||||
|
run: $GITHUB_ACTION_PATH/action/entrypoint.sh
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
INPUT_FILES: ${{ inputs.files }}
|
||||||
|
INPUT_EXTEND_IDENTIFIERS: ${{ inputs.extend_identifiers }}
|
||||||
|
INPUT_EXTEND_WORDS: ${{ inputs.extend_words }}
|
||||||
|
INPUT_ISOLATED: ${{ inputs.isolated }}
|
||||||
|
INPUT_WRITE_CHANGES: ${{ inputs.write_changes }}
|
||||||
|
INPUT_CONFIG: ${{ inputs.config }}
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: "link"
|
icon: "link"
|
||||||
|
|
|
@ -30,10 +30,12 @@ if [[ -z $(ls ${TARGET} 2>/dev/null) ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ -z $(which ${CMD_NAME} 2>/dev/null) ]]; then
|
if [[ -z $(which ${CMD_NAME} 2>/dev/null) ]]; then
|
||||||
log "ERROR: 'typos' not found"
|
VERSION=1.13.22
|
||||||
exit 1
|
log "Downloading 'typos' v${VERSION}"
|
||||||
|
wget https://github.com/crate-ci/typos/releases/download/v${VERSION}/typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz
|
||||||
|
sudo tar -xzvf typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz -C /usr/local/bin ./typos
|
||||||
|
rm typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz
|
||||||
fi
|
fi
|
||||||
log "typos: $(typos --version)"
|
|
||||||
log "jq: $(jq --version)"
|
log "jq: $(jq --version)"
|
||||||
|
|
||||||
ARGS="${TARGET}"
|
ARGS="${TARGET}"
|
|
@ -25,7 +25,7 @@ pre-release-replacements = [
|
||||||
{file="../../CHANGELOG.md", search="ReleaseDate", replace="{{date}}", min=1},
|
{file="../../CHANGELOG.md", search="ReleaseDate", replace="{{date}}", min=1},
|
||||||
{file="../../CHANGELOG.md", search="<!-- next-header -->", replace="<!-- next-header -->\n## [Unreleased] - ReleaseDate\n", exactly=1},
|
{file="../../CHANGELOG.md", search="<!-- next-header -->", replace="<!-- next-header -->\n## [Unreleased] - ReleaseDate\n", exactly=1},
|
||||||
{file="../../CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/crate-ci/typos/compare/{{tag_name}}...HEAD", exactly=1},
|
{file="../../CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/crate-ci/typos/compare/{{tag_name}}...HEAD", exactly=1},
|
||||||
{file="../../docker/Dockerfile", search="ARG VERSION=.*", replace="ARG VERSION={{version}}", min=1},
|
{file="../../action/entrypoint.sh", search="VERSION=.*", replace="VERSION={{version}}", min=1},
|
||||||
{file="../../docs/pre-commit.md", search="rev: .*", replace="rev: {{tag_name}}", exactly=1},
|
{file="../../docs/pre-commit.md", search="rev: .*", replace="rev: {{tag_name}}", exactly=1},
|
||||||
{file="../../setup.py", search="TYPOS_VERSION = .*", replace="TYPOS_VERSION = '{{version}}'", exactly=1},
|
{file="../../setup.py", search="TYPOS_VERSION = .*", replace="TYPOS_VERSION = '{{version}}'", exactly=1},
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
FROM ubuntu:22.04
|
|
||||||
ARG VERSION=1.13.22
|
|
||||||
ENV VERSION=${VERSION}
|
|
||||||
RUN apt-get update && apt-get install -y wget git jq
|
|
||||||
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 && \
|
|
||||||
mv typos /usr/local/bin
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
|
||||||
COPY format_gh.sh /format_gh.sh
|
|
||||||
WORKDIR /github/workspace
|
|
||||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
|
Loading…
Reference in a new issue