fix syntax error for job environment github-script-poc.yml #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: github-script-poc | ||
on: | ||
push: | ||
env: | ||
project_name: GitHub.Script | ||
environment_name: Production | ||
is_production: false | ||
environment_url: https://postman-load-test.azurewebsites.net | ||
deployment_description: Sample GitHub-Script Deployment | ||
jobs: | ||
poc-test: | ||
runs-on: ubuntu-latest | ||
name: Sandbox Testing | ||
environment: | ||
name: ${{ env.project_name }}-${{ env.environment_name }} | ||
Check failure on line 17 in .github/workflows/github-script-poc.yml GitHub Actions / github-script-pocInvalid workflow file
|
||
url: ${{ steps.deploy-website.outputs.deployment_url }} | ||
steps: | ||
# - name: View context attributes | ||
# uses: actions/github-script@v7 | ||
# with: | ||
# script: console.log(context) | ||
- name: Create Sample GitHub Deployment | ||
uses: actions/github-script@v4 | ||
id: github-deployment-create | ||
with: | ||
script: | | ||
const deployment = await github.repos.createDeployment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: context.ref, | ||
auto_merge: false, | ||
description: "${{ env.deployment_description }}", | ||
required_contexts: [], | ||
task: "deploy", | ||
environment: "${{ env.project_name }}-${{ env.environment_name }}", | ||
production_environment: ${{ env.is_production }} | ||
}); | ||
console.log(deployment); | ||
if (deployment.status === 201) { | ||
core.setOutput('id', deployment.data.id); | ||
return deployment.data; | ||
} else { | ||
throw new Error(`Failed to create deployment: ${deployment.status}`); | ||
} | ||
- name: Deployment | ||
id: deploy-website | ||
run: echo "deployment_url=${{ env.environment_url }}" >> "$GITHUB_OUTPUT" | ||
- name: Create Sample Deployment Status (completed) | ||
uses: actions/github-script@v4 | ||
id: github-deployment-completed | ||
with: | ||
script: | | ||
const deploymentStatus = await github.repos.createDeploymentStatus({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
deployment_id: "${{ steps.github-deployment-create.outputs.id }}", | ||
state: 'success', | ||
log_url: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | ||
description: "${{ env.deployment_description }}", | ||
environment_url: "${{ env.environment_url }}", | ||
environment: "${{ env.project_name }}-${{ env.environment_name }}", | ||
production_environment: ${{ env.is_production }} | ||
}); | ||
- name: Generate Deployment Summary | ||
run: | | ||
echo "This is the lead in sentence for the list" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY # this is a blank line | ||
echo "- Lets add a bullet point" >> $GITHUB_STEP_SUMMARY | ||
echo "- Lets add a second bullet point" >> $GITHUB_STEP_SUMMARY | ||
echo "- How about a third one?" >> $GITHUB_STEP_SUMMARY |