Token Expiry Reminder #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Token Expiry Reminder | |
| on: | |
| schedule: | |
| - cron: '0 0 1 */3 *' # Every 3 months (Jan, Apr, Jul, Oct) | |
| workflow_dispatch: | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production | |
| permissions: | |
| issues: write | |
| steps: | |
| - name: Verify VS Code Marketplace PAT | |
| id: vsce | |
| continue-on-error: true | |
| run: | | |
| STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ | |
| -u ":${{ secrets.VSCE_PAT }}" \ | |
| "https://marketplace.visualstudio.com/_apis/gallery/publishers/Pleiades?api-version=6.0-preview.1") | |
| echo "status=$STATUS" >> "$GITHUB_OUTPUT" | |
| if [ "$STATUS" != "200" ]; then | |
| echo "VSCE PAT is invalid (HTTP $STATUS)" | |
| exit 1 | |
| fi | |
| echo "VSCE PAT is valid" | |
| - name: Verify Open VSX PAT | |
| id: ovsx | |
| continue-on-error: true | |
| run: | | |
| STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ | |
| -H "Authorization: Bearer ${{ secrets.OVSX_PAT }}" \ | |
| "https://open-vsx.org/api/-/user") | |
| echo "status=$STATUS" >> "$GITHUB_OUTPUT" | |
| if [ "$STATUS" != "200" ]; then | |
| echo "Open VSX PAT is invalid (HTTP $STATUS)" | |
| exit 1 | |
| fi | |
| echo "Open VSX PAT is valid" | |
| - name: Create issue if any PAT is expired | |
| if: steps.vsce.outcome == 'failure' || steps.ovsx.outcome == 'failure' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| VSCE_RESULT: ${{ steps.vsce.outcome }} | |
| OVSX_RESULT: ${{ steps.ovsx.outcome }} | |
| run: | | |
| EXISTING=$(gh issue list -R "$GITHUB_REPOSITORY" --label "token-expiry" --state open --json number --jq length) | |
| if [ "$EXISTING" != "0" ]; then | |
| echo "Issue already exists, skipping" | |
| exit 0 | |
| fi | |
| BODY="## Marketplace トークンが期限切れです\n\n" | |
| BODY+="| Token | Status |\n|---|---|\n" | |
| BODY+="| VSCE_PAT | ${VSCE_RESULT} |\n" | |
| BODY+="| OVSX_PAT | ${OVSX_RESULT} |\n\n" | |
| BODY+="### VS Code Marketplace PAT 再生成手順\n" | |
| BODY+="1. **Windows Edge** で https://dev.azure.com/cypher256/_usersSettings/tokens を開く\n" | |
| BODY+="2. **New Token** → Organization: **All accessible organizations** → Expiration: Custom **1年** → Scopes: **Marketplace (Manage)**\n" | |
| BODY+="3. トークンをコピーして GitHub Secret **VSCE_PAT** を更新\n\n" | |
| BODY+="### Open VSX PAT 再生成手順\n" | |
| BODY+="1. https://open-vsx.org/user-settings/tokens で再生成\n" | |
| BODY+="2. GitHub Secret **OVSX_PAT** を更新\n\n" | |
| BODY+="### Secret 更新コマンド\n" | |
| BODY+="\`\`\`bash\n" | |
| BODY+="gh secret set VSCE_PAT -R cypher256/java-extension-pack -e production\n" | |
| BODY+="gh secret set OVSX_PAT -R cypher256/java-extension-pack -e production\n" | |
| BODY+="\`\`\`\n\n" | |
| BODY+="### 注意\n" | |
| BODY+="- Azure DevOps は **kashihara@live.jp** でログイン\n" | |
| BODY+="- Mac ブラウザでは AD アカウント干渉でエラーになる場合あり、Windows Edge を使う\n" | |
| gh issue create -R "$GITHUB_REPOSITORY" \ | |
| --title "Marketplace token expired" \ | |
| --label "token-expiry" \ | |
| --body "$(echo -e "$BODY")" |