Azure / Azure/static-web-apps

Close pull request job does not give the corresponding deployed url - Github actions

Open
#682 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

I would like to get the staging url created in the previous (build_and_deploy_job) job in the close_pull_request_job job. My goal is to go ahead and remove the url from the redirectUri list in Azure app service. But for some reason, when I tried steps.closepullrequest.outputs.static_web_app_url, it is an empty string.

**To Reproduce**
Steps to reproduce the behavior:
name: Azure Static Web Apps CI/CD

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

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
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- 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_HAPPY_RIVER_01F5A930F }}
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: "build" # Built app content directory - optional
env:
VITE_AG_GRID_LICENSE_KEY: ${{secrets.VITE_AG_GRID_LICENSE_KEY}}
VITE_API_SCOPE: ${{secrets.VITE_API_SCOPE}}
VITE_CLIENT_ID: ${{secrets.VITE_CLIENT_ID}}
VITE_SOURCE_LOADER_BASE_URL: ${{secrets.VITE_SOURCE_LOADER_BASE_URL_DEV}}
VITE_TENANT_ID: ${{secrets.VITE_TENANT_ID}}
- run: echo ${{ steps.builddeploy.outputs.static_web_app_url }}

- name: Add redirect uri
id: addRedirectUri
uses: fjogeleit/http-request-action@master
with:
url: 'url'
method: 'POST'
data: '{"redirectURI": "${{steps.builddeploy.outputs.static_web_app_url}}", "route": "create"}'

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_HAPPY_RIVER_01F5A930F }}
action: "close"
- run: echo ${{ steps.closepullrequest.outputs.static_web_app_url }}
- name: Remove redirect uri
id: removeRedirectUri
uses: fjogeleit/http-request-action@master
with:
url: 'url'
method: 'POST'
data: '{"redirectURI": "${{ steps.closepullrequest.outputs.static_web_app_url }}", "route": "delete"}'

**Expected behavior**
Should give me the url. I have access to the pull_request_number. An alternate solution for me is to get the subdomain so I can compose the url on my own.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Device info (if applicable):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.