Skip to content

Commit 5b3f544

Browse files
cypher256claude
andcommitted
Update publish workflow and add token expiry check
- Update vsce.yml: add Open VSX publish, upgrade to actions v4, use npm ci - Add token-expiry-check.yml: verify PAT via API every 3 months, auto-create issue with renewal instructions if expired (skips if open issue exists) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1a0c331 commit 5b3f544

2 files changed

Lines changed: 86 additions & 8 deletions

File tree

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Token Expiry Reminder
2+
on:
3+
schedule:
4+
- cron: '0 0 1 */3 *' # Every 3 months (Jan, Apr, Jul, Oct)
5+
workflow_dispatch:
6+
jobs:
7+
check:
8+
runs-on: ubuntu-latest
9+
environment:
10+
name: production
11+
permissions:
12+
issues: write
13+
steps:
14+
- name: Verify VS Code Marketplace PAT
15+
id: vsce
16+
continue-on-error: true
17+
run: |
18+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
19+
-u ":${{ secrets.VSCE_PAT }}" \
20+
"https://marketplace.visualstudio.com/_apis/gallery/publishers/Pleiades?api-version=6.0-preview.1")
21+
echo "status=$STATUS" >> "$GITHUB_OUTPUT"
22+
if [ "$STATUS" != "200" ]; then
23+
echo "VSCE PAT is invalid (HTTP $STATUS)"
24+
exit 1
25+
fi
26+
echo "VSCE PAT is valid"
27+
28+
- name: Verify Open VSX PAT
29+
id: ovsx
30+
continue-on-error: true
31+
run: |
32+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
33+
-H "Authorization: Bearer ${{ secrets.OVSX_PAT }}" \
34+
"https://open-vsx.org/api/-/user")
35+
echo "status=$STATUS" >> "$GITHUB_OUTPUT"
36+
if [ "$STATUS" != "200" ]; then
37+
echo "Open VSX PAT is invalid (HTTP $STATUS)"
38+
exit 1
39+
fi
40+
echo "Open VSX PAT is valid"
41+
42+
- name: Create issue if any PAT is expired
43+
if: steps.vsce.outcome == 'failure' || steps.ovsx.outcome == 'failure'
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
VSCE_RESULT: ${{ steps.vsce.outcome }}
47+
OVSX_RESULT: ${{ steps.ovsx.outcome }}
48+
run: |
49+
EXISTING=$(gh issue list --label "token-expiry" --state open --json number --jq length)
50+
if [ "$EXISTING" != "0" ]; then
51+
echo "Issue already exists, skipping"
52+
exit 0
53+
fi
54+
BODY="## Marketplace トークンが期限切れです\n\n"
55+
BODY+="| Token | Status |\n|---|---|\n"
56+
BODY+="| VSCE_PAT | ${VSCE_RESULT} |\n"
57+
BODY+="| OVSX_PAT | ${OVSX_RESULT} |\n\n"
58+
BODY+="### VS Code Marketplace PAT 再生成手順\n"
59+
BODY+="1. **Windows Edge** で https://dev.azure.com/cypher256/_usersSettings/tokens を開く\n"
60+
BODY+="2. **New Token** → Organization: **All accessible organizations** → Expiration: Custom **1年** → Scopes: **Marketplace (Manage)**\n"
61+
BODY+="3. トークンをコピーして GitHub Secret **VSCE_PAT** を更新\n\n"
62+
BODY+="### Open VSX PAT 再生成手順\n"
63+
BODY+="1. https://open-vsx.org/user-settings/tokens で再生成\n"
64+
BODY+="2. GitHub Secret **OVSX_PAT** を更新\n\n"
65+
BODY+="### Secret 更新コマンド\n"
66+
BODY+="\`\`\`bash\n"
67+
BODY+="gh secret set VSCE_PAT -R cypher256/java-extension-pack -e production\n"
68+
BODY+="gh secret set OVSX_PAT -R cypher256/java-extension-pack -e production\n"
69+
BODY+="\`\`\`\n\n"
70+
BODY+="### 注意\n"
71+
BODY+="- Azure DevOps は **kashihara@live.jp** でログイン\n"
72+
BODY+="- Mac ブラウザでは AD アカウント干渉でエラーになる場合あり、Windows Edge を使う\n"
73+
gh issue create \
74+
--title "Marketplace token expired" \
75+
--label "token-expiry" \
76+
--body "$(echo -e "$BODY")"

.github/workflows/vsce.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
name: Deploy Extension
1+
name: Publish Extension
22
on:
33
workflow_dispatch:
44
jobs:
5-
deploy:
5+
publish:
66
runs-on: ubuntu-latest
77
environment:
88
name: production
99
steps:
10-
- uses: actions/checkout@v3
11-
- run: npm install
12-
- uses: lannonbr/vsce-action@3.0.0
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-node@v4
1312
with:
14-
args: "publish -p $VSCE_TOKEN"
15-
env:
16-
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
13+
node-version: 20
14+
- run: npm ci
15+
- name: Publish to VS Code Marketplace
16+
run: npx vsce publish -p ${{ secrets.VSCE_PAT }}
17+
- name: Publish to Open VSX
18+
run: npx ovsx publish -p ${{ secrets.OVSX_PAT }}

0 commit comments

Comments
 (0)