|
10 | 10 | runs-on: ubuntu-latest |
11 | 11 | timeout-minutes: 30 |
12 | 12 | steps: |
| 13 | + - name: Generate CI token |
| 14 | + id: github-ci-app-token |
| 15 | + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 |
| 16 | + with: |
| 17 | + client-id: ${{ vars.CODEQL_CI_APP_CLIENT_ID }} |
| 18 | + owner: github |
| 19 | + permission-contents: write |
| 20 | + permission-actions: read |
| 21 | + private-key: ${{ secrets.CODEQL_CI_APP_PRIVATE_KEY }} |
| 22 | + repositories: codeql-variant-analysis-action |
| 23 | + |
13 | 24 | - name: Trigger variant analysis |
14 | 25 | id: trigger |
15 | 26 | run: | |
|
35 | 46 | EOF |
36 | 47 | echo "input.json: $(cat input.json)" |
37 | 48 |
|
38 | | - RESPONSE=$(curl --no-progress-meter -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" "https://api.github.com/repos/$GITHUB_REPOSITORY/code-scanning/codeql/variant-analyses" -X POST -d @input.json) |
| 49 | + RESPONSE=$(curl --no-progress-meter -H "Authorization: Bearer ${{ steps.github-ci-app-token.outputs.token }}" "https://api.github.com/repos/$GITHUB_REPOSITORY/code-scanning/codeql/variant-analyses" -X POST -d @input.json) |
39 | 50 | echo "Response: $RESPONSE" |
40 | 51 |
|
41 | 52 | ID="$(echo "$RESPONSE" | jq '.id')" |
|
51 | 62 | - name: Wait for variant analysis to complete |
52 | 63 | run: | |
53 | 64 | while true; do |
54 | | - RESPONSE=$(curl --no-progress-meter -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" "https://api.github.com/repos/$GITHUB_REPOSITORY/code-scanning/codeql/variant-analyses/${{ steps.trigger.outputs.variant_analysis_id }}") |
| 65 | + RESPONSE=$(curl --no-progress-meter -H "Authorization: Bearer ${{ steps.github-ci-app-token.outputs.token }}" "https://api.github.com/repos/$GITHUB_REPOSITORY/code-scanning/codeql/variant-analyses/${{ steps.trigger.outputs.variant_analysis_id }}") |
55 | 66 | STATUS="$(echo "$RESPONSE" | jq '.status' -r)" |
56 | 67 | ACTIONS_WORKFLOW_RUN_ID="$(echo "$RESPONSE" | jq '.actions_workflow_run_id' -r)" |
57 | 68 | echo "Variant analysis ${{ steps.trigger.outputs.variant_analysis_id }} status: $STATUS" |
|
68 | 79 | - name: Validate variant analysis status |
69 | 80 | id: validate |
70 | 81 | run: | |
71 | | - RESPONSE=$(curl --no-progress-meter -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" "https://api.github.com/repos/$GITHUB_REPOSITORY/code-scanning/codeql/variant-analyses/${{ steps.trigger.outputs.variant_analysis_id }}") |
| 82 | + RESPONSE=$(curl --no-progress-meter -H "Authorization: Bearer ${{ steps.github-ci-app-token.outputs.token }}" "https://api.github.com/repos/$GITHUB_REPOSITORY/code-scanning/codeql/variant-analyses/${{ steps.trigger.outputs.variant_analysis_id }}") |
72 | 83 | echo "Response: $RESPONSE" |
73 | 84 | echo "Actions workflow URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$(echo "$RESPONSE" | jq '.actions_workflow_run_id')" |
74 | 85 |
|
@@ -132,7 +143,7 @@ jobs: |
132 | 143 | exit 1 |
133 | 144 | fi |
134 | 145 |
|
135 | | - ACTIONS_RESPONSE=$(curl --no-progress-meter -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" "https://api.github.com/repos/$GITHUB_REPOSITORY/actions/runs/$(echo "$RESPONSE" | jq '.actions_workflow_run_id')") |
| 146 | + ACTIONS_RESPONSE=$(curl --no-progress-meter -H "Authorization: Bearer ${{ steps.github-ci-app-token.outputs.token }}" "https://api.github.com/repos/$GITHUB_REPOSITORY/actions/runs/$(echo "$RESPONSE" | jq '.actions_workflow_run_id')") |
136 | 147 |
|
137 | 148 | if [ "$(echo "$ACTIONS_RESPONSE" | jq '.status' -r)" != "completed" ]; then |
138 | 149 | echo "Actions workflow status is not completed" |
|
0 commit comments