diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..50e06b6 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: TenorJS-v2 Deploy Automation + +on: + push: + branches: + - main + +env: + DHUB_UNAME: ${{ secrets.DHUB_UNAME }} + DHUB_PWORD: ${{ secrets.DHUB_PWORD }} + +jobs: + build: + runs-on: self-hosted + steps: + - name: Pull latest from Git + run: | + echo "${{ gitea.ref_name }}" + pwd + whoami + mkdir -p /var/lib/act_runner/ + cd /var/lib/act_runner/ + if [ ! -d "tenorjs-v2" ]; then + git clone https://git.vfsh.dev/voidf1sh/tenorjs-v2 + cd tenorjs-v2 + else + cd tenorjs-v2 + git pull + fi + git checkout ${{ gitea.ref_name }} + - name: Publish to NPM + run: | + cd /var/lib/act_runner/tenorjs-v2 + npm publish \ No newline at end of file diff --git a/src/index.js b/src/index.js index c7ee271..6d9f563 100644 --- a/src/index.js +++ b/src/index.js @@ -90,6 +90,9 @@ class Tenor { // Return the results resolve(gifs); }).catch(error => { + if (error.response.status >= 400 && error.response.status <= 499) { + return reject(new Error('Invalid API Key Provided: ' + this.token)); + } return reject(error); }); });