Skip to content

Commit d45fa3c

Browse files
committed
chore: add private key validation test
1 parent ea94d45 commit d45fa3c

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

.github/workflows/release.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,39 @@ jobs:
1717
pull-requests: write
1818
id-token: write
1919
steps:
20-
- name: Test JWT Generation
20+
- name: Checkout for debugging
21+
uses: actions/checkout@v4
22+
23+
- name: Debug GitHub App Setup
2124
run: |
22-
npm install -g jsonwebtoken
23-
node -e "
24-
const jwt = require('jsonwebtoken');
25+
echo "Testing GitHub App configuration..."
26+
echo "APP_ID: $APP_ID"
27+
echo "Installation URL: https://github.com/organizations/vue-pivottable/settings/installations/66276079"
28+
29+
# Create a simple script to test JWT generation
30+
cat > test-jwt.js << 'EOF'
31+
const crypto = require('crypto');
32+
2533
const privateKey = process.env.PRIVATE_KEY;
2634
const appId = process.env.APP_ID;
2735
36+
console.log('App ID:', appId);
37+
console.log('Private Key length:', privateKey.length);
38+
console.log('Private Key starts with:', privateKey.substring(0, 30));
39+
console.log('Private Key ends with:', privateKey.substring(privateKey.length - 30));
40+
41+
// Simple test to see if it's a valid RSA key
2842
try {
29-
const now = Math.floor(Date.now() / 1000);
30-
const payload = {
31-
iat: now - 60,
32-
exp: now + 600,
33-
iss: appId
34-
};
35-
const token = jwt.sign(payload, privateKey, { algorithm: 'RS256' });
36-
console.log('✓ JWT generated successfully');
37-
console.log('Token length:', token.length);
43+
const sign = crypto.createSign('RSA-SHA256');
44+
sign.update('test');
45+
sign.sign(privateKey, 'base64');
46+
console.log('✓ Private key is valid for signing');
3847
} catch (error) {
39-
console.error('✗ JWT generation failed:', error.message);
48+
console.error('✗ Private key validation failed:', error.message);
4049
}
41-
"
50+
EOF
51+
52+
node test-jwt.js
4253
env:
4354
APP_ID: ${{ secrets.APP_ID }}
4455
PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}

0 commit comments

Comments
 (0)