test #30
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: Trigger ADO Pipeline | |
| # Run this workflow when an issue is opened | |
| # This triggers the ADO Pipeline with issue information | |
| on: | |
| issues: | |
| types: [opened, closed, reopened] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| build: | |
| name: Trigger Extension Release Pipeline on Issue Open | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
| with: | |
| egress-policy: audit | |
| - name: Azure login | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.ADO_SP_ClientID }} | |
| tenant-id: ${{ secrets.ADO_SP_TenantID }} | |
| allow-no-subscriptions: true | |
| - name: Get issue details | |
| id: issue_details | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const issue = context.payload.issue; | |
| const issue_number = issue.number; | |
| const output = { | |
| issue_number: issue_number, | |
| }; | |
| const issueData = JSON.stringify(output); | |
| console.log("Output:", issueData); | |
| core.exportVariable('ISSUE_DATA', issueData); | |
| - name: Parse issue details from environment variable | |
| run: | | |
| echo "Issue Data: $ISSUE_DATA" | |
| echo "Issue Number: $(echo $ISSUE_DATA | jq -r '.issue_number')" | |
| - name: Azure CLI | |
| uses: azure/cli@v2 | |
| env: | |
| ado-org: ${{ secrets.ADO_ORGANIZATION }} | |
| ado-project: ${{ secrets.ADO_PROJECT }} | |
| ado-pipeline-id: ${{ secrets.ADO_PIPELINE_ID }} | |
| issue-data: ${{ env.ISSUE_DATA }} | |
| with: | |
| inlineScript: | | |
| az pipelines build queue \ | |
| --definition-id ${{ env.ado-pipeline-id }} \ | |
| --organization ${{ env.ado-org }} \ | |
| --project ${{ env.ado-project }} \ | |
| --variables issue_data='${{ env.issue-data }}' \ | |
| --debug --verbose |