tshoot github actions #5
This file contains 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: tshoot github actions | |
on: | |
workflow_dispatch: | |
jobs: | |
tshoot-github-actions: | |
strategy: | |
max-parallel: 2 | |
matrix: | |
os: | |
- self-hosted-ubuntu-22.04 | |
- macos-15 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: check for the inverse of self-hosted runner | |
if: ${{ !contains(matrix.os, 'self-hosted-ubuntu-22.04') }} | |
run: | | |
echo "this should only print on NON self-hosted runners" | |
- name: check for self-hosted runner | |
if: ${{ contains(matrix.os, 'self-hosted-ubuntu-22.04') }} | |
run: | | |
echo "this should only print on self-hosted runners" | |
- name: Test GitHub Token | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} | |
run: | | |
# if [ -z "$GITHUB_TOKEN" ]; then | |
# echo "Error: GITHUB_TOKEN is not set." | |
# exit 1 | |
# fi | |
RESPONSE=$(curl -s -L \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/${{ github.repository }}) | |
echo "API response: $RESPONSE" | |
if echo "$RESPONSE" | grep -q '"message": "Bad credentials"'; then | |
echo "Error: Bad credentials - the GitHub token may be invalid or lacks permissions." | |
exit 1 | |
fi | |
echo "Success: GitHub token is valid." | |