test(ci): test token usage for delivery action

This commit is contained in:
Kevin Duret 2024-12-05 17:06:48 +01:00
parent 13552496ba
commit fa50ed353b
2 changed files with 9 additions and 5 deletions

View File

@ -22,6 +22,9 @@ inputs:
artifactory_token:
description: "token for artifactory"
required: true
github_token:
description: "token for github"
required: true
runs:
using: "composite"
@ -29,11 +32,11 @@ runs:
- name: Check workflow statuses and display token usage
run: |
echo "github token rate usage:"
curl -s -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ github.token }}" https://api.github.com/rate_limit | jq .rate
curl -s -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ github.token }}" https://api.github.com/rate_limit
echo ""
echo ""
echo "anonymous rate usage:"
curl -s -H "Accept: application/vnd.github+json" https://api.github.com/rate_limit | jq .rate
curl -s -H "Accept: application/vnd.github+json" https://api.github.com/rate_limit
echo ""
echo ""
shell: bash
@ -41,7 +44,7 @@ runs:
- name: Download packages from testing
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ github.token }}
github-token: ${{ inputs.github_token }}
script: |
const warningNoPromote = 'No packages are promoted because push is not related to a hotfix/release pull request.';
const commitSha = context.sha;
@ -53,11 +56,11 @@ runs:
- name: Check workflow statuses and display token usage
run: |
echo "github token rate usage:"
curl -s -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ github.token }}" https://api.github.com/rate_limit | jq .rate
curl -s -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ github.token }}" https://api.github.com/rate_limit
echo ""
echo ""
echo "anonymous rate usage:"
curl -s -H "Accept: application/vnd.github+json" https://api.github.com/rate_limit | jq .rate
curl -s -H "Accept: application/vnd.github+json" https://api.github.com/rate_limit
echo ""
echo ""
shell: bash

View File

@ -47,3 +47,4 @@ jobs:
stability: ${{ needs.get-environment.outputs.stability }}
release_type: ${{ needs.get-environment.outputs.release_type }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}