Skip to content

Commit 5753d43

Browse files
committed
Debugging workflow issue
1 parent ec22ec4 commit 5753d43

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.github/actions/debug/actions.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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."

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test Release Packages
2+
3+
on:
4+
push:
5+
branches:
6+
- chore-fix-github-workflow-for-faustwp-plugin
7+
8+
jobs:
9+
release_packages:
10+
name: Release Packages
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: Checkout Repo
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0 # Ensure full Git history
17+
18+
- name: Set Plugin Version (Fallback)
19+
run: echo "PLUGIN_VERSION=1.0.0-test" >> $GITHUB_ENV
20+
21+
- name: Deploy WordPress Plugin
22+
uses: ./.github/actions/debug
23+
env:
24+
PLUGIN_DIR: plugins/faustwp
25+
SLUG: faustwp
26+
VERSION: ${{ env.PLUGIN_VERSION }}

0 commit comments

Comments
 (0)