fix(ci): skip Railway deployment and Coveralls upload when tokens unavailable

Dependabot PRs lack access to repository secrets, causing workflow failures.
This change adds token availability checks with informative warnings, allowing
CI to complete successfully while skipping deployment steps that require secrets.

Coverage generation still runs to maintain build verification, but upload is
conditional on token availability.
This commit is contained in:
Ryan Walters
2025-11-23 11:48:58 -06:00
parent 0338188e94
commit cc6a1a4c6a
2 changed files with 17 additions and 0 deletions

View File

@@ -56,6 +56,14 @@ jobs:
just coverage just coverage
working-directory: pacman working-directory: pacman
- name: Check Coveralls Token
run: |
if [ -z "${{ secrets.COVERALLS_REPO_TOKEN }}" ]; then
echo "::warning::COVERALLS_REPO_TOKEN not available - coverage upload skipped (common for Dependabot PRs)"
else
echo "COVERALLS_REPO_TOKEN is available - will upload coverage"
fi
- name: Coveralls upload - name: Coveralls upload
if: ${{ secrets.COVERALLS_REPO_TOKEN != '' }} if: ${{ secrets.COVERALLS_REPO_TOKEN != '' }}
uses: coverallsapp/github-action@v2 uses: coverallsapp/github-action@v2

View File

@@ -132,8 +132,17 @@ jobs:
env: env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }} RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
steps: steps:
- name: Check Railway Token
run: |
if [ -z "$RAILWAY_TOKEN" ]; then
echo "::warning::RAILWAY_TOKEN not available - deployment skipped (common for Dependabot PRs)"
exit 0
fi
- name: Generate proxy Dockerfile - name: Generate proxy Dockerfile
if: env.RAILWAY_TOKEN != ''
run: echo "FROM ghcr.io/xevion/pac-man@${{ needs.build-and-deploy.outputs.digest }}" > Dockerfile run: echo "FROM ghcr.io/xevion/pac-man@${{ needs.build-and-deploy.outputs.digest }}" > Dockerfile
- name: Deploy to Railway - name: Deploy to Railway
if: env.RAILWAY_TOKEN != ''
run: railway up --service pac-man run: railway up --service pac-man