Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build.yaml): createWorkflowDispatch() bug fixed #30

Merged
merged 2 commits into from
Sep 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ jobs:
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}

deployment:
name: Update deployment
runs-on: ubuntu-latest
needs: build
steps:
- name: Update deployment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.DEPLOYMENT_PAT }}
script: |
if(!'${{ secrets.DEPLOYMENT_PAT }}') {
console.log('No PAT provided, skipping deployment update')
return
}

const owner = '${{ secrets.DEPLOYMENT_OWNER }}'
const repo = '${{ secrets.DEPLOYMENT_REPO }}'
const workflow_id = '${{ secrets.DEPLOYMENT_WORKFLOW }}'
Expand All @@ -103,7 +103,8 @@ jobs:
return
}

await github.actions.createWorkflowDispatch({
// Trigger the workflow dispatch using Octokit API (from github object)
await github.rest.actions.createWorkflowDispatch({
owner: owner,
repo: repo,
workflow_id: workflow_id,
Expand All @@ -112,4 +113,6 @@ jobs:
version: version,
deployment: deployment_name,
}
})
});

console.log('Workflow dispatch triggered successfully.');