|
1 | | -name: Debug GitHub Actions Environment |
2 | | - |
3 | | -on: workflow_dispatch |
4 | | - |
5 | | -jobs: |
6 | | - debug: |
7 | | - runs-on: ubuntu-latest |
8 | | - steps: |
9 | | - - name: Debug GitHub Actions Environment |
10 | | - env: |
11 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
12 | | - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
13 | | - run: | |
14 | | - echo "### 🔍 Checking GitHub Secrets & Environment Variables ###" |
15 | | -
|
16 | | - # Check if GITHUB_TOKEN is set |
17 | | - if [[ -z "$GITHUB_TOKEN" ]]; then |
18 | | - echo "❌ GITHUB_TOKEN is NOT set. Ensure it is available in repository secrets."; |
19 | | - else |
20 | | - echo "✅ GITHUB_TOKEN is set."; |
21 | | - fi |
22 | | -
|
23 | | - # Check if NPM_TOKEN is set |
24 | | - if [[ -z "$NPM_TOKEN" ]]; then |
25 | | - echo "❌ NPM_TOKEN is NOT set. Ensure it exists in repository secrets."; |
26 | | - else |
27 | | - echo "✅ NPM_TOKEN is set."; |
28 | | - fi |
29 | | -
|
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: | |
37 | | - echo "🔹 Workflow permissions setting:" |
38 | | - curl -s -H "Authorization: token $GITHUB_TOKEN" \ |
39 | | - -H "Accept: application/vnd.github.v3+json" \ |
40 | | - "https://api.github.com/repos/${{ github.repository }}" \ |
41 | | - | jq '.permissions' |
42 | | -
|
43 | | - - name: Check Fork Status |
44 | | - run: | |
45 | | - if [[ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then |
46 | | - echo "⚠️ This workflow is running from a fork. GitHub restricts repository secrets for forks."; |
47 | | - else |
48 | | - echo "✅ This workflow is running in the original repository."; |
49 | | - fi |
50 | | -
|
51 | | - - name: Check System Environment Variables |
52 | | - run: | |
53 | | - echo "🔹 Checking system environment variables:" |
54 | | - env | grep -E 'GITHUB|NPM' || echo "⚠️ No GITHUB/NPM environment variables found." |
| 1 | +name: "Debug GitHub Actions Environment" |
| 2 | +description: "Check GitHub Secrets & Environment Variables" |
| 3 | + |
| 4 | +inputs: |
| 5 | + github_token: |
| 6 | + description: "GitHub Token" |
| 7 | + required: true |
| 8 | + npm_token: |
| 9 | + description: "NPM Token" |
| 10 | + required: false |
| 11 | + |
| 12 | +runs: |
| 13 | + using: "composite" |
| 14 | + steps: |
| 15 | + - name: Debug GitHub Secrets & Environment |
| 16 | + shell: bash |
| 17 | + env: |
| 18 | + GITHUB_TOKEN: ${{ inputs.github_token }} |
| 19 | + NPM_TOKEN: ${{ inputs.npm_token }} |
| 20 | + run: | |
| 21 | + echo "### 🔍 Checking GitHub Secrets & Environment Variables ###" |
| 22 | +
|
| 23 | + # Check if GITHUB_TOKEN is set |
| 24 | + if [[ -z "$GITHUB_TOKEN" ]]; then |
| 25 | + echo "❌ GITHUB_TOKEN is NOT set. Ensure it is passed correctly."; |
| 26 | + else |
| 27 | + echo "✅ GITHUB_TOKEN is set."; |
| 28 | + fi |
| 29 | +
|
| 30 | + # Check if NPM_TOKEN is set |
| 31 | + if [[ -z "$NPM_TOKEN" ]]; then |
| 32 | + echo "❌ NPM_TOKEN is NOT set."; |
| 33 | + else |
| 34 | + echo "✅ NPM_TOKEN is set."; |
| 35 | + fi |
0 commit comments