11name : Publish
22on :
3- release :
4- types : [published]
3+ workflow_dispatch :
4+ inputs :
5+ cab_id :
6+ description : " CAB id for the change/release"
7+ required : true
8+ type : string
59
610jobs :
711 publish :
@@ -96,4 +100,55 @@ jobs:
96100 job_url : " https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
97101 button_type : " danger"
98102 package_version : ${{needs.publish.outputs.release_number}}
99- repo_link : ${{github.server_url}}/${{github.repository}}
103+ repo_link : ${{github.server_url}}/${{github.repository}}
104+
105+ notify-codegen-repo :
106+ needs : publish
107+ if : always()
108+ runs-on : ubuntu-latest
109+ permissions :
110+ contents : write
111+ pull-requests : write
112+
113+ steps :
114+ - name : Checkout
115+ uses : actions/checkout@v4
116+ with :
117+ repository : XeroAPI/xero-node
118+ path : xero-node
119+
120+ - name : Install octokit dependencies
121+ run : npm i
122+ working-directory : ${{ github.workspace }}/.github/octokit
123+
124+ - name : Get github app access token
125+ id : get_access_token
126+ env :
127+ GITHUB_APP_ID : ${{ secrets.XERO_CODEGEN_BOT_APPLICATION_ID }}
128+ GITHUB_APP_PRIVATE_KEY : ${{ secrets.XERO_CODEGEN_BOT_APPLICATION_KEY }}
129+ uses : actions/github-script@v7
130+ with :
131+ result-encoding : string
132+ script : |
133+ const { getAccessToken } = await import('${{ github.workspace }}/.github/octokit/index.js')
134+ const token = await getAccessToken()
135+ return token
136+
137+ - name : Notify codegen repo
138+ run : |
139+ curl -X POST -H "Authorization: token ${{ steps.get_access_token.outputs.result }}" \
140+ -H "Accept: application/vnd.github.v3+json" \
141+ -H "Content-Type: application/json" \
142+ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/notify-sdk-publish.yml/dispatches \
143+ -d '{
144+ "ref": "deploy-track-pipeline-changes",
145+ "inputs": {
146+ "commit": "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}",
147+ "status": "${{needs.publish.result}}",
148+ "deployer": "xero-codegen-bot",
149+ "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
150+ "environment": "test",
151+ "sdk_type": "node",
152+ "cab_key": ${{ github.event.inputs.cab_id }}
153+ }
154+ }'
0 commit comments