Charts Values Seed Trigger Dispatcher #4
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: Charts Values Seed Trigger Dispatcher | |
| on: | |
| workflow_run: | |
| workflows: | |
| - "Build and Push Capacitor (Atlan fork)" | |
| branches: | |
| - atlan/main | |
| - atlan/beta | |
| types: | |
| - completed | |
| jobs: | |
| charts-release-dispatcher: | |
| name: Dispatch | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| repo: ['atlanhq/atlan'] | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| steps: | |
| - name: Get branch name | |
| id: extract_branch | |
| run: | | |
| branch="${{ github.event.workflow_run.head_branch }}" | |
| # atlan/beta -> beta, atlan/main -> main (for atlan repo) | |
| echo "dispatch_branch=${branch#atlan/}" >> $GITHUB_OUTPUT | |
| # keep original branch for checkout in this repo | |
| echo "source_branch=${branch}" >> $GITHUB_OUTPUT | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.ORG_PAT_GITHUB }} | |
| ref: ${{ steps.extract_branch.outputs.source_branch }} | |
| fetch-depth: 0 | |
| - name: Get SHA of the branch | |
| id: get_sha | |
| run: | | |
| branch_name=${{ steps.extract_branch.outputs.source_branch }} | |
| sha=$(git rev-parse "refs/heads/$branch_name") | |
| echo "GIT_SHA: $sha" | |
| echo "sha=${sha}" >> $GITHUB_OUTPUT | |
| - name: Extract Repository Name | |
| id: extract_repo_name | |
| run: | | |
| repo_name=$(basename $GITHUB_REPOSITORY) | |
| echo "repo_name=${repo_name}" >> $GITHUB_OUTPUT | |
| - name: Get PR url and PR User | |
| id: get_pr_url_user | |
| run: | | |
| head_sha=$(curl -s -H "Authorization: Bearer ${{ secrets.ORG_PAT_GITHUB }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/jobs" | jq -r '.jobs[0].head_sha') | |
| echo "Head SHA: $head_sha" | |
| pr_url=$(curl -s -H "Authorization: Bearer ${{ secrets.ORG_PAT_GITHUB }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/search/issues?q=sha:$head_sha+type:pr" | jq -r '.items[0].html_url') | |
| pr_user=$(curl -s -H "Authorization: Bearer ${{ secrets.ORG_PAT_GITHUB }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/search/issues?q=sha:$head_sha+type:pr" | jq -r '.items[0].user.login') | |
| echo "pr_url=$pr_url" >> $GITHUB_OUTPUT | |
| echo "pr_user=$pr_user" >> $GITHUB_OUTPUT | |
| - name: Repository Dispatch | |
| uses: peter-evans/repository-dispatch@v2 | |
| with: | |
| token: ${{ secrets.ORG_PAT_GITHUB }} | |
| repository: ${{ matrix.repo }} | |
| event-type: dispatch_chart_release_workflow | |
| client-payload: |- | |
| { | |
| "repo": { | |
| "name": "${{ steps.extract_repo_name.outputs.repo_name }}", | |
| "branch": "${{ steps.extract_branch.outputs.dispatch_branch }}", | |
| "pr_url": "${{ steps.get_pr_url_user.outputs.pr_url }}", | |
| "pr_user": "${{ steps.get_pr_url_user.outputs.pr_user }}" | |
| } | |
| } |