Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,16 @@ To set the value, just add the environment variable to the actions step, as seen
OVERLEAF_COOKIE: ${{ secrets.OVERLEAF_COOKIE }}
OVERLEAF_HOST: ${{ secrets.OVERLEAF_HOST }}
```

### OVERLEAF_COOKIE_KEY
The OVERLEAF_COOKIE_KEY parameter can be used to sync with a self-hosted Community Edition or Server Pro Overleaf instance. Since some instances use differnt names for the authentification cooke (e.g overleaf.sid) the name of the cookie can be changed using this parameter. The parameter defaults to `overleaf_session2`, when not set.

To set the value, just add the environment variable to the actions step, as seen below:
```
- name: Fetch the latest version from overleaf server
uses: subhamx/overleaf_sync_with_git@master
with:
OVERLEAF_PROJECT_ID: ${{ secrets.OVERLEAF_PROJECT_ID }}
OVERLEAF_COOKIE: ${{ secrets.OVERLEAF_COOKIE }}
OVERLEAF_COOKIE_KEY: ${{ secrets.OVERLEAF_COOKIE_KEY }}
```
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ description: "🤖 A GitHub action to take backups from OverLeaf which is an Onl


inputs:
OVERLEAF_COOKIE: # id of input
OVERLEAF_COOKIE:
description: "Active Cookie of overleaf account"
required: true
OVERLEAF_COOKIE_KEY:
description: "The key of the cookie, default is overleaf_session2"
default: "overleaf_session2"
OVERLEAF_PROJECT_ID: # id of input
description: "Id of the project you want the bot to take automatic snapshot"
required: true
Expand All @@ -23,6 +26,7 @@ runs:
image: "Dockerfile"
args:
- ${{ inputs.OVERLEAF_COOKIE }}
- ${{ inputs.OVERLEAF_COOKIE_KEY }}
- ${{ inputs.OVERLEAF_PROJECT_ID }}
- ${{ inputs.OVERLEAF_HOST }}

3 changes: 2 additions & 1 deletion src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ PROJECT_ID="$INPUT_OVERLEAF_PROJECT_ID"
ZIP_OUTPUT_PATH="${1}/main.zip"
EXTRACTED_FILES_PATH="./artifacts/"
COOKIE=$(echo "$INPUT_OVERLEAF_COOKIE" | sed 's/.*=//g')
COOKIE_KEY="$INPUT_OVERLEAF_COOKIE_KEY"
HOST="$INPUT_OVERLEAF_HOST"

echo "Dumping zip file at $ZIP_OUTPUT_PATH"
Expand All @@ -21,7 +22,7 @@ curl "https://$HOST/project/$PROJECT_ID/download/zip" \
-H 'upgrade-insecure-requests: 1' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
-H 'accept-language: en-US,en;q=0.9' \
-H "Cookie: overleaf_session2=$COOKIE" \
-H "Cookie: $COOKIE_KEY=$COOKIE" \
--output "$ZIP_OUTPUT_PATH" --create-dirs

echo "Extracting all files at $EXTRACTED_FILES_PATH"
Expand Down