Skip to content

Commit 52cdea7

Browse files
committed
Fixing syntax issues with test debug yaml file.
1 parent 003f1e2 commit 52cdea7

File tree

1 file changed

+50
-42
lines changed

1 file changed

+50
-42
lines changed

.github/actions/debug/action.yml

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,50 @@
1-
- name: Debug GitHub Actions Environment
2-
run: |
3-
echo "### 🔍 Checking GitHub Secrets & Environment Variables ###"
4-
5-
# Check if GITHUB_TOKEN is set
6-
if [[ -z "${{ secrets.GITHUB_TOKEN }}" ]]; then
7-
echo "❌ GITHUB_TOKEN is NOT set. This may be due to missing permissions or a misconfigured repository secret.";
8-
else
9-
echo "✅ GITHUB_TOKEN is set.";
10-
fi
11-
12-
# Check if NPM_TOKEN is set
13-
if [[ -z "${{ secrets.NPM_TOKEN }}" ]]; then
14-
echo "❌ NPM_TOKEN is NOT set. Ensure it exists in repository secrets under Settings → Secrets.";
15-
else
16-
echo "✅ NPM_TOKEN is set.";
17-
fi
18-
19-
# Check if the GitHub token from the context is available
20-
if [[ -z "${{ github.token }}" ]]; then
21-
echo "❌ github.token is NOT set. This is unusual since it's auto-generated by GitHub.";
22-
else
23-
echo "✅ github.token is available.";
24-
fi
25-
26-
# Check current GitHub Actions permissions
27-
echo "🔹 Workflow permissions setting:"
28-
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
29-
-H "Accept: application/vnd.github.v3+json" \
30-
https://api.github.com/repos/${{ github.repository }} \
31-
| jq '.permissions'
32-
33-
# Check if running from a forked repo (which can block secrets)
34-
if [[ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
35-
echo "⚠️ This workflow is running from a fork. GitHub restricts repository secrets for forks.";
36-
else
37-
echo "✅ This workflow is running in the original repository.";
38-
fi
39-
40-
# Check if environment variables are set
41-
echo "🔹 Checking system environment variables:"
42-
env | grep -E 'GITHUB|NPM' || echo "⚠️ No GITHUB/NPM environment variables found."
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+
run: |
11+
echo "### 🔍 Checking GitHub Secrets & Environment Variables ###"
12+
13+
# Check if GITHUB_TOKEN is set
14+
if [[ -z "${{ secrets.GITHUB_TOKEN }}" ]]; then
15+
echo "❌ GITHUB_TOKEN is NOT set. This may be due to missing permissions or a misconfigured repository secret.";
16+
else
17+
echo "✅ GITHUB_TOKEN is set.";
18+
fi
19+
20+
# Check if NPM_TOKEN is set
21+
if [[ -z "${{ secrets.NPM_TOKEN }}" ]]; then
22+
echo "❌ NPM_TOKEN is NOT set. Ensure it exists in repository secrets under Settings → Secrets.";
23+
else
24+
echo "✅ NPM_TOKEN is set.";
25+
fi
26+
27+
# Check if the GitHub token from the context is available
28+
if [[ -z "${{ github.token }}" ]]; then
29+
echo "❌ github.token is NOT set. This is unusual since it's auto-generated by GitHub.";
30+
else
31+
echo "✅ github.token is available.";
32+
fi
33+
34+
# Check current GitHub Actions permissions
35+
echo "🔹 Workflow permissions setting:"
36+
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
37+
-H "Accept: application/vnd.github.v3+json" \
38+
https://api.github.com/repos/${{ github.repository }} \
39+
| jq '.permissions'
40+
41+
# Check if running from a forked repo (which can block secrets)
42+
if [[ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
43+
echo "⚠️ This workflow is running from a fork. GitHub restricts repository secrets for forks.";
44+
else
45+
echo "✅ This workflow is running in the original repository.";
46+
fi
47+
48+
# Check if environment variables are set
49+
echo "🔹 Checking system environment variables:"
50+
env | grep -E 'GITHUB|NPM' || echo "⚠️ No GITHUB/NPM environment variables found."

0 commit comments

Comments
 (0)