GitHub Pages error with workflow file environment variables

Does anyone know how to provide environment variables to a live site on GitHub Pages?

I am trying to deploy my site to GitHub Pages and use environment variables that I have entered in the secrets setting on GitHub but am getting errors with my .yaml workflow file. The site works without the use of a workflow at all but the user needs to enter in the environment variables and I would change it so that is not necessary and the documentation I found on GitHub says that you can do this through the use of workflows so I have tried to implement one but can’t seem to figure it out.

Most of this code is taken from other sites that I have commented in the file and show working examples, but I am getting a lot of errors when I try to replicate various examples like:

  • “There was an error initializing the repository: Branch is required.”
  • “Failed to download action ‘https://api.github.com/repos/spk2dc/github-pages-deploy-action/tarball/releases/v3’. Error Response status code does not indicate success: 404 (Not Found).”
name: Deploy to GitHub Pages
on:
  push:
    branches:
      - master
jobs:
  deploy:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [13.2.0]
    steps:
      - name: Checkout
        uses: actions/checkout@master

      - name: Deploy to production
        uses: JamesIves/github-pages-deploy-action@releases/v3
        env:
          BUILD_PATH: public
          BRANCH: master # The branch the action should deploy to.
          GITHUB_PAGE_NAME: spk2dc.github.io
          PA_TOKEN: ${{ secrets.PA_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN_KEY }}
          CLIENT_ID: ${{ secrets.CLIENT_ID }}
          CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
          

###### source: https://github.com/marketplace/actions/deploy-your-app-to-github-pages ######
###### source: https://stackoverflow.com/questions/53648652/how-to-use-environment-variables-in-github-page ######
###### source: https://dev.to/pierresaid/deploy-node-projects-to-github-pages-with-github-actions-4jco ######
###### source: https://github.com/marketplace/actions/deploy-to-github-pages ######

Go to Source
Author: Senthil Kannan