From 4061356537d1742782b996ced2ca552628a87e07 Mon Sep 17 00:00:00 2001 From: Patrick Roddy Date: Fri, 27 Oct 2023 16:37:25 +0100 Subject: [PATCH] Add LaTeX actions (#19) --- actions/dropbox/README.md | 15 ++++++++++++ actions/dropbox/actions.yml | 39 ++++++++++++++++++++++++++++++++ actions/latex/README.md | 5 ++++ actions/latex/chktex/README.md | 13 +++++++++++ actions/latex/chktex/action.yml | 18 +++++++++++++++ actions/latex/compile/README.md | 13 +++++++++++ actions/latex/compile/action.yml | 14 ++++++++++++ actions/latex/vale/README.md | 24 ++++++++++++++++++++ actions/latex/vale/action.yml | 23 +++++++++++++++++++ 9 files changed, 164 insertions(+) create mode 100644 actions/dropbox/README.md create mode 100644 actions/dropbox/actions.yml create mode 100644 actions/latex/README.md create mode 100644 actions/latex/chktex/README.md create mode 100644 actions/latex/chktex/action.yml create mode 100644 actions/latex/compile/README.md create mode 100644 actions/latex/compile/action.yml create mode 100644 actions/latex/vale/README.md create mode 100644 actions/latex/vale/action.yml diff --git a/actions/dropbox/README.md b/actions/dropbox/README.md new file mode 100644 index 0000000..31e3c12 --- /dev/null +++ b/actions/dropbox/README.md @@ -0,0 +1,15 @@ +# Dropbox + +This action can be used in the following manner: + +```yaml +jobs: + chktex: + runs-on: ubuntu-latest + steps: + - uses: paddyroddy/.github/actions/dropbox@vx.y.z + with: + files-to-upload: "example.pdf" +``` + +where `x.y.z` is the `major.minor.patch` version of the action. diff --git a/actions/dropbox/actions.yml b/actions/dropbox/actions.yml new file mode 100644 index 0000000..9d332d8 --- /dev/null +++ b/actions/dropbox/actions.yml @@ -0,0 +1,39 @@ +name: Dropbox +description: Upload files to Dropbox + +inputs: + files-to-upload: + description: A list of files to upload to dropbox + required: true + +runs: + using: composite + steps: + - name: checkout source + uses: actions/checkout@v4 + + - name: Set up Dropbox + run: | + echo "CONFIGFILE_VERSION=$CONFIGFILE_VERSION" > ~/.dropbox_uploader + echo "OAUTH_APP_KEY=$OAUTH_APP_KEY" >> ~/.dropbox_uploader + echo "OAUTH_APP_SECRET=$OAUTH_APP_SECRET" >> ~/.dropbox_uploader + echo "OAUTH_REFRESH_TOKEN=$OAUTH_REFRESH_TOKEN" >> ~/.dropbox_uploader + env: + CONFIGFILE_VERSION: ${{secrets.CONFIGFILE_VERSION}} + OAUTH_APP_KEY: ${{secrets.OAUTH_APP_KEY}} + OAUTH_APP_SECRET: ${{secrets.OAUTH_APP_SECRET}} + OAUTH_REFRESH_TOKEN: ${{secrets.OAUTH_REFRESH_TOKEN}} + + - name: Retrieve Dropbox uploader script + run: | + curl "https://raw.githubusercontent.com/andreafabrizi/\ + Dropbox-Uploader/master/dropbox_uploader.sh" \ + -o dropbox_uploader.sh + chmod +x dropbox_uploader.sh + + - name: Upload PDF + run: | + for file in ${{ inputs.files-to-upload }}; do \ + echo $file; \ + ./dropbox_uploader.sh upload $file $file; \ + done diff --git a/actions/latex/README.md b/actions/latex/README.md new file mode 100644 index 0000000..ac8492e --- /dev/null +++ b/actions/latex/README.md @@ -0,0 +1,5 @@ +# LaTeX Composite Actions + +A set of +[composite actions](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action) +specific to LaTeX, that can be called by other workflows. diff --git a/actions/latex/chktex/README.md b/actions/latex/chktex/README.md new file mode 100644 index 0000000..aafaed0 --- /dev/null +++ b/actions/latex/chktex/README.md @@ -0,0 +1,13 @@ +# chktex + +This action can be used in the following manner: + +```yaml +jobs: + chktex: + runs-on: ubuntu-latest + steps: + - uses: paddyroddy/.github/actions/latex/chktex@vx.y.z +``` + +where `x.y.z` is the `major.minor.patch` version of the action. diff --git a/actions/latex/chktex/action.yml b/actions/latex/chktex/action.yml new file mode 100644 index 0000000..4fabb29 --- /dev/null +++ b/actions/latex/chktex/action.yml @@ -0,0 +1,18 @@ +name: ChkTeX +description: Runs ChkTeX over all TeX files in the repo + +runs: + using: composite + steps: + - name: checkout source + uses: actions/checkout@v4 + + - name: Run chktex + uses: xu-cheng/texlive-action@v2 + with: + scheme: full + run: |- + for file in *.tex; do \ + echo $file; \ + chktex $file | tee /dev/stderr | (! grep -q ^); \ + done diff --git a/actions/latex/compile/README.md b/actions/latex/compile/README.md new file mode 100644 index 0000000..b56bf85 --- /dev/null +++ b/actions/latex/compile/README.md @@ -0,0 +1,13 @@ +# compile + +This action can be used in the following manner: + +```yaml +jobs: + compile-latex: + runs-on: ubuntu-latest + steps: + - uses: paddyroddy/.github/actions/latex/compile@vx.y.z +``` + +where `x.y.z` is the `major.minor.patch` version of the action. diff --git a/actions/latex/compile/action.yml b/actions/latex/compile/action.yml new file mode 100644 index 0000000..a9e8739 --- /dev/null +++ b/actions/latex/compile/action.yml @@ -0,0 +1,14 @@ +name: Compile LaTeX +description: Runs latexmk on the repo + +runs: + using: composite + steps: + - name: checkout source + uses: actions/checkout@v4 + + - name: Build PDF + uses: xu-cheng/texlive-action@v2 + with: + scheme: full + run: latexmk -quiet diff --git a/actions/latex/vale/README.md b/actions/latex/vale/README.md new file mode 100644 index 0000000..aa29d21 --- /dev/null +++ b/actions/latex/vale/README.md @@ -0,0 +1,24 @@ +# vale + +This action can be used in the following manner: + +```yaml +jobs: + vale: + runs-on: ubuntu-latest + steps: + - uses: paddyroddy/.github/actions/latex/vale@vx.y.z +``` + +where `x.y.z` is the `major.minor.patch` version of the action. If flags are +required for vale, then modify the above to: + +```yaml +jobs: + vale: + runs-on: ubuntu-latest + steps: + - uses: paddyroddy/.github/actions/latex/vale@vx.y.z + with: + vale-flags: "" +``` diff --git a/actions/latex/vale/action.yml b/actions/latex/vale/action.yml new file mode 100644 index 0000000..fd099cb --- /dev/null +++ b/actions/latex/vale/action.yml @@ -0,0 +1,23 @@ +name: Vale +description: Runs vale over all TeX files in the repo + +inputs: + vale-flags: + description: Flags to pass to vale + default: "" + +runs: + using: composite + steps: + - name: checkout source + uses: actions/checkout@v4 + + - name: Run Vale + uses: errata-ai/vale-action@v2 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + fail_on_error: true + filter_mode: nofilter + reporter: github-check + vale_flags: ${{ inputs.vale-flags }}