6

I have a Github Action to deploy my static web app to Azure.

On the Build and Deploy step it fails with deployment_token was not provided.

Below is my workflow yml file. I've changed secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_scrubbed in the file I posted from my full Azure static name.

I've created a Github environment with the name : Azure-new-host holding one secret AZURE_STATIC_WEB_APPS_API_TOKEN_scrubbed with the Deployment token from Azure.

I have looked in Github Environment secerts and Azure KeyVault


on:
  push:
    branches:
      - main
  pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
      - main

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    environment:
      name:Azure-new-host
      url:https://github.com
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_scrubbed }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "/" # App source code path
          api_location: "" # Api source code path - optional
          output_location: "dist" # Built app content directory - optional
          ###### End of Repository/Build Configurations ######

  close_pull_request_job:
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    runs-on: ubuntu-latest
    name: Close Pull Request Job
    steps:
      - name: Close Pull Request
        id: closepullrequest
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_scrubbed }}
          action: "close"
OrigamiEye
  • 864
  • 1
  • 12
  • 31
  • Had the same problem. Did a re-build on latest (successful) main commit. Re-build PR afterwards. The error disappeared. – Markus Schulte Nov 30 '21 at 15:06
  • I ended up creatinga new Azure Static Web App and pointing to the same repository – OrigamiEye Dec 01 '21 at 20:15
  • 1
    Note that is is also the error you'll get if the action was triggered by a PR from a forked repo. GitHub runs the action in the fork namespace, where the secrets are not set. – PatL Dec 21 '21 at 14:08

0 Answers0