11name : Check Packagist Publish
22
33on :
4- release :
5- types : [published]
4+ workflow_dispatch :
5+ inputs :
6+ cab_id :
7+ description : " CAB id for the change/release"
8+ required : true
9+ type : string
610
711jobs :
812 check-publish :
7781 if : ${{env.packagist_status == 'failure'}}
7882 run : |
7983 echo "Job failed because packagist is not updated"
80- exit 1
84+ exit 1
85+
86+ - name : Install octokit dependencies
87+ run : npm i
88+ working-directory : ${{ github.workspace }}/.github/octokit
89+
90+ - name : Get github app access token
91+ id : get_access_token
92+ env :
93+ GITHUB_APP_ID : ${{ secrets.XERO_CODEGEN_BOT_APPLICATION_ID }}
94+ GITHUB_APP_PRIVATE_KEY : ${{ secrets.XERO_CODEGEN_BOT_APPLICATION_KEY }}
95+ uses : actions/github-script@v7
96+ with :
97+ result-encoding : string
98+ script : |
99+ const { getAccessToken } = await import('${{ github.workspace }}/.github/octokit/index.js')
100+ const token = await getAccessToken()
101+ return token
102+
103+ - name : Notify codegen repo
104+ if : always()
105+ run : |
106+ curl -X POST -H "Authorization: token ${{ steps.get_access_token.outputs.result }}" \
107+ -H "Accept: application/vnd.github.v3+json" \
108+ -H "Content-Type: application/json" \
109+ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/notify-sdk-publish.yml/dispatches \
110+ -d '{
111+ "ref": "master",
112+ "inputs": {
113+ "commit": "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}",
114+ "status": "${{env.packagist_status}}",
115+ "deployer": "xero-codegen-bot",
116+ "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
117+ "environment": "test",
118+ "sdk_type": "node",
119+ "cab_key": ${{ github.event.inputs.cab_id }}
120+ }
121+ }'
0 commit comments