|
7 | 7 | runs-on: ubuntu-latest |
8 | 8 | steps: |
9 | 9 | - name: Debug GitHub Actions Environment |
| 10 | + env: |
| 11 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 12 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
10 | 13 | run: | |
11 | 14 | echo "### 🔍 Checking GitHub Secrets & Environment Variables ###" |
12 | 15 |
|
13 | 16 | # Check if GITHUB_TOKEN is set |
14 | 17 | if [[ -z "$GITHUB_TOKEN" ]]; then |
15 | | - echo "❌ GITHUB_TOKEN is NOT set. This may be due to missing permissions or a misconfigured repository secret."; |
| 18 | + echo "❌ GITHUB_TOKEN is NOT set. Ensure it is available in repository secrets."; |
16 | 19 | else |
17 | 20 | echo "✅ GITHUB_TOKEN is set."; |
18 | 21 | fi |
19 | 22 |
|
20 | 23 | # Check if NPM_TOKEN is set |
21 | 24 | if [[ -z "$NPM_TOKEN" ]]; then |
22 | | - echo "❌ NPM_TOKEN is NOT set. Ensure it exists in repository secrets under Settings → Secrets."; |
| 25 | + echo "❌ NPM_TOKEN is NOT set. Ensure it exists in repository secrets."; |
23 | 26 | else |
24 | 27 | echo "✅ NPM_TOKEN is set."; |
25 | 28 | fi |
26 | | - echo "### 🔍 Checking GitHub Secrets & Environment Variables ###" |
27 | 29 |
|
28 | | - # Check current GitHub Actions permissions |
| 30 | + - name: Install jq |
| 31 | + run: sudo apt-get update && sudo apt-get install -y jq |
| 32 | + |
| 33 | + - name: Check GitHub Actions Permissions |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + run: | |
29 | 37 | echo "🔹 Workflow permissions setting:" |
30 | 38 | curl -s -H "Authorization: token $GITHUB_TOKEN" \ |
31 | 39 | -H "Accept: application/vnd.github.v3+json" \ |
32 | | - https://api.github.com/repos/${{ github.repository }} \ |
| 40 | + "https://api.github.com/repos/${{ github.repository }}" \ |
33 | 41 | | jq '.permissions' |
34 | 42 |
|
35 | | - # Check if running from a forked repo (which can block secrets) |
| 43 | + - name: Check Fork Status |
| 44 | + run: | |
36 | 45 | if [[ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then |
37 | 46 | echo "⚠️ This workflow is running from a fork. GitHub restricts repository secrets for forks."; |
38 | 47 | else |
39 | 48 | echo "✅ This workflow is running in the original repository."; |
40 | 49 | fi |
41 | 50 |
|
42 | | - # Check if environment variables are set |
| 51 | + - name: Check System Environment Variables |
| 52 | + run: | |
43 | 53 | echo "🔹 Checking system environment variables:" |
44 | 54 | env | grep -E 'GITHUB|NPM' || echo "⚠️ No GITHUB/NPM environment variables found." |
0 commit comments