-
Notifications
You must be signed in to change notification settings - Fork 2
36 lines (35 loc) · 1.62 KB
/
gdrive.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: GDrive
on:
push:
paths: links.json
watch:
types: [ started ]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Get Share Link
id: link
run: echo "::set-output name=gds::$(jq -r .gdrive_link links.json | sed -E s@"https?://drive.google.com/file/d/([^/]+)/\w*||https?://drive.google.com/open\?id=([^/]+)/\w*"@"\1\2"@g)"
- name: Download file
run: |
wget -o logcat.txt --server-response --content-disposition --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=${{ steps.link.outputs.gds }}' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=${{ steps.link.outputs.gds }}" && rm -rf /tmp/cookies.txt
cat logcat.txt | grep Content-Disposition: | cut -d "'" -f 3 > filename.txt
sed -i '2,$d' filename.txt
python -c "import urllib;print urllib.unquote(raw_input())" <<< $(cat filename.txt) > filename.txt
- name: Filename
id: fn
run: echo "::set-output name=fn::$(cat filename.txt)"
- name: Upload
run: |
curl -sL https://git.io/file-transfer | sh
./transfer wet "${{ steps.fn.outputs.fn }}" > tmp.txt
cat tmp.txt | grep Download | cut -d ' ' -f 3 > gdlink.txt
- name: Push File
run: |
git config --global user.email "[email protected]"
git config --global user.name "Insouciant21"
git add gdlink.txt
git commit -m "link"
git push