ci: add outputs to sandbox #3
Workflow file for this run
This file contains hidden or 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: Dispatch events based on push to sandbox branch | |
on: | |
push: | |
branches: | |
- sandbox/** | |
pull_request: | |
types: | |
- opened | |
jobs: | |
dispatch: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
if: startsWith(github.ref, 'refs/heads/sandbox/') | |
id: app-token | |
with: | |
app-id: ${{ secrets.APP_ID }} | |
private-key: ${{ secrets.PRIVATE_KEY }} | |
owner: ${{ github.repository_owner }} | |
- name: Repository dispatch | |
if: startsWith(github.ref, 'refs/heads/sandbox/') | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
repository: kubeshop/testkube-deployment | |
event-type: sandbox_agent_charts_update | |
client-payload: '{"ref": "${{ github.ref }}", "ref_name": "${{ github.ref_name }}", "agent_sha": "${{ github.sha }}", "repository": "${{ github.repository }}"}' | |
- name: Output summary | |
if: startsWith(github.ref, 'refs/heads/sandbox/') | |
run: | | |
echo -e "### Sandbox Environment" >> $GITHUB_STEP_SUMMARY | |
echo -e '```' >> $GITHUB_STEP_SUMMARY | |
echo -e "## URLs" >> $GITHUB_STEP_SUMMARY | |
echo "- Dashboard: https://dashboard.${{ github.ref_name }}.testkube.dev" >> $GITHUB_STEP_SUMMARY | |
echo "- API: https://api.${{ github.ref_name }}.testkube.dev" >> $GITHUB_STEP_SUMMARY | |
echo "- Agent: https://agent.${{ github.ref_name }}.testkube.dev" >> $GITHUB_STEP_SUMMARY | |
echo "- Storage: https://storage.${{ github.ref_name }}.testkube.dev" >> $GITHUB_STEP_SUMMARY | |
echo "- Websockets: https://websockets.${{ github.ref_name }}.testkube.dev" >> $GITHUB_STEP_SUMMARY | |
echo -e '```' >> $GITHUB_STEP_SUMMARY | |
- name: Get a branch name if PR is created | |
if: startsWith(github.event.pull_request.head.ref, 'sandbox/') | |
run: | | |
# get a branch name | |
branch_ref="${{ github.event.pull_request.head.ref }}" | |
#remove slash | |
branch_ref="${branch_ref#*/}" | |
#create env var | |
echo "branch_ref=$branch_ref" >> $GITHUB_ENV | |
- name: Render template | |
if: startsWith(github.event.pull_request.head.ref, 'sandbox/') | |
id: template | |
uses: chuhlomin/[email protected] | |
with: | |
template: .github/comment-template.md | |
vars: | | |
branch_ref: ${{ env.branch_ref }} | |
- name: Create comment on a PR with the endpoints | |
if: startsWith(github.event.pull_request.head.ref, 'sandbox/') | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
token: ${{ secrets.CI_BOT_TOKEN }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: ${{ steps.template.outputs.result }} | |