Question: Purchases table

```
create table purchase ( 
id integer primary key, 
purchasedate date not null, 
purchasesum numeric(12,2) not null )

```

contains purchase sums. How to find change percent from previos year:

```
select
  extract( year from purchasedate ),
  sum( purchasesum),
  ( sum( purchasesum) - previous row sum( previous purchasesum ) ) /
                previous row sum( previous purchasesum ) * 100
from purchase
group by 1
order by 1

```

Result should be

```
2014     1200
2015     1320    +10%
2016     14784   +12%
2017     1774.08 +20%
2018     1596.67 -10% 
2019     2075.67 +30%

```

Using Postgresql 9.1+

Answer: 
A very straightforward solution that requires only **read-only** access to the repo. Uses GitHub's Deploy Keys and the following action <https://github.com/webfactory/ssh-agent>

#### 1. Provide a private repo in `package.json` in the following format:

```
"dependencies": {
    "repo": "git+ssh://git@github.com:user/private_repo.git",
}

```

#### 2. Generate a deploy key locally on your machine. Use empty passphrase

```
ssh-keygen -f my_key

```

#### 3. Create a deploy key via GitHub UI (prefer read-only). Use contents of `my_key.pub`

[![Deploy keys](https://i.stack.imgur.com/8oR5r.png)](https://i.stack.imgur.com/8oR5r.png)

#### 4. Create a GitHub Actions secret named `REPO_SSH_KEY` for the target repo via GitHub UI - the one that will be running GitHub Actions. Use contents of `my_key` – it is a private key

[![SSH secret](https://i.stack.imgur.com/U9Oh2.png)](https://i.stack.imgur.com/U9Oh2.png)

#### 5. Update the GitHub Actions workflow file to look like this

```
# ...
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Add SSH key to chekout a private repo
        uses: webfactory/ssh-agent@v0.5.4
        with:
          ssh-private-key: ${{ secrets.REPO_SSH_KEY }}

      - name: Checkout code
        uses: actions/checkout@v2

      # ...
      # the rest of the steps, including npm install
      # that will successfully access the private repo

```
From the error and the way you've included the dependency (in package.json), it seems you are not passing authentication credentials (token, ssh. 

Refer to this documentation for specifics on [Git URLs as Dependencies](https://docs.npmjs.com/files/package.json#git-urls-as-dependencies)

It can be done via https and oauth or ssh.

**https and oauth**: [create an access token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) that has "repo" scope and then [use this syntax](http://rzrsharp.net/2013/07/02/private-github-repos-with-npm-and-heroku.html):

```
"package-name": "git+https://<github_token>:x-oauth-basic@github.com/<user>/<repo>.git"

```

or

**ssh**: Setup ssh and then use this syntax:

```
"package-name": "git+ssh://git@github.com:<user>/<repo>.git"
(note the use of colon instead of slash before user)

```