chore(deps): update helm release kube-state-metrics to v5.27.1 #225
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: comment action | |
on: | |
issue_comment: | |
types: | |
- created | |
jobs: | |
trigger: | |
name: Trigger helm-install action | |
if: ${{ github.event.issue.pull_request && github.event.comment.author_association == 'OWNER' }} | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
issues: write | |
pull-requests: write | |
steps: | |
- uses: actions/github-script@v7 | |
with: | |
script: | | |
let createComment = function (message) { | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: message | |
}); | |
} | |
const parsed = context.payload.comment.body.match(/\/(?<command>[^\s]+) (?<deployment>[^\s]+)/); | |
if (parsed == null) return; | |
if (parsed.groups.command == 'deploy') { | |
try { | |
const pull_request = await github.rest.pulls.get({ | |
owner: context.payload.repository.owner.login, | |
repo: context.payload.repository.name, | |
pull_number: context.payload.issue.number | |
}); | |
const dispatch = await github.rest.actions.createWorkflowDispatch({ | |
owner: context.payload.repository.owner.login, | |
repo: context.payload.repository.name, | |
workflow_id: "helm-install.yaml", | |
ref: pull_request.data.head.ref, | |
inputs: { deployment: parsed.groups.deployment } | |
}); | |
console.log(dispatch) | |
createComment("✅ Created new [helm-install](https://github.com/klausmeyer/k8s-pi-cluster/actions/workflows/helm-install.yaml) workflow run"); | |
} | |
catch (error) { | |
if (error.status) { | |
createComment(`💥 ${error.message}`); | |
} | |
else { | |
throw error; | |
} | |
} | |
} | |
else { | |
createComment(`🙃 Unknown command: ${parsed.groups.command}`); | |
} |