diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml new file mode 100644 index 0000000..781334b --- /dev/null +++ b/.github/workflows/markdown-lint.yml @@ -0,0 +1,10 @@ +--- +name: markdown-lint +on: + push: +jobs: + markdown-lint: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 + - uses: articulate/actions-markdownlint@v1 diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 0000000..27fbdea --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,15 @@ +--- +name: shellcheck +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + shellcheck: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: ludeeus/action-shellcheck@master diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1234b05 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,15 @@ +name: test +on: + push: + pull_request: +jobs: + test: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: ./ + with: + cmd: latexmk + path: . + opts: -pdf test + packages: ffcode fvextra catchfile xstring framed environ upquote diff --git a/.github/workflows/up.yml b/.github/workflows/up.yml new file mode 100644 index 0000000..2ac0432 --- /dev/null +++ b/.github/workflows/up.yml @@ -0,0 +1,25 @@ +--- +name: up +on: + push: + branches: + - master + tags: + - '*' +jobs: + up: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - run: |- + git fetch --tags --force && \ + latest=$(git tag --sort=creatordate | tail -1) && \ + sed -E -i "s/bibcop-action@.+$/bibcop-action@${latest}/g" README.md + - uses: peter-evans/create-pull-request@v6 + with: + branch: version-up + commit-message: 'new version in README' + delete-branch: true + title: 'New version in README' + assignees: yegor256 + base: master \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0393a2b --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +test.pdf +test.aux +test.dvi +test.fdb_latexmk +test.fls +test.log \ No newline at end of file diff --git a/.rultor.yml b/.rultor.yml new file mode 100644 index 0000000..6554106 --- /dev/null +++ b/.rultor.yml @@ -0,0 +1,11 @@ +docker: + image: yegor256/rultor-image:1.23.0 +merge: + script: |- + sudo docker build "$(pwd)" +release: + pre: false + script: |- + [[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1 + sed -i -e "s/^0.0.0/${tag}/" Dockerfile + sudo docker build "$(pwd)" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e58cecf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# MIT License +# +# Copyright (c) 2024 Yegor Bugayenko +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +FROM yegor256/rultor-image:1.23.1 + +LABEL "repository"="https://github.com/yegor256/bibcop-action" +LABEL "maintainer"="Yegor Bugayenko" + +RUN wget https://yegor256.github.io/bibcop/bibcop.pl /home/bibcop.pl + +WORKDIR /home +COPY entry.sh /home + +ENTRYPOINT ["/home/entry.sh"] diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..0add847 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021-2024 Yegor Bugayenko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cc2f0cb --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +# MIT License +# +# Copyright (c) 2024 Yegor Bugayenko +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +test: + docker run --rm -v "$$(pwd):/w" $$(docker build -q .) + +clean: + rm -f *.dvi *.pdf *.fls *.aux *.fdb_latexmk *.log \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..4f4db5c --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# Bibcop Github Action + +[![test](https://github.com/yegor256/bibcop-action/actions/workflows/test.yml/badge.svg)](https://github.com/yegor256/bibcop-action/actions/workflows/test.yml) +[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/bibcop-action/blob/master/LICENSE.txt) + +Checks the quality of all `.bib` files in the repository, +using [bibcop](https://github.com/yegor256/bibcop). + +```yaml +name: bibcop +on: + push: +jobs: + bibcop: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@master + - uses: yegor256/bibcop-action@0.0.0 +``` + +## How to Contribute + +In order to test this action, just run: + +```bash +make test +``` + +This should build a new Docker image and then try to use it +in order to render a simple `test.tex` document. You need to have +[Docker](https://docs.docker.com/get-docker/) installed. diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..23a2ff9 --- /dev/null +++ b/action.yml @@ -0,0 +1,35 @@ +# MIT License +# +# Copyright (c) 2021-2024 Yegor Bugayenko +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- +name: 'bibcop-action' +description: 'Check the quality of .bib files' +branding: + icon: alert-triangle + color: orange +runs: + using: 'docker' + image: Dockerfile +inputs: + opts: + description: 'Command-line options for bibcop' + required: false + default: '' diff --git a/entry.sh b/entry.sh new file mode 100755 index 0000000..0aed4f2 --- /dev/null +++ b/entry.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# MIT License +# +# Copyright (c) 2024 Yegor Bugayenko +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +set -x +set -e +set -o pipefail + +cd "${GITHUB_WORKSPACE-/w}" + +read -r -a opts <<< "${INPUT_OPTS}" + +chmod a+x /home/bibcop.pl +find . -name '.bib' -exec /home/bibcop.pl "${opts[@]}" {} \; diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..39a2b6e --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base" + ] +}