Skip to content

Cleanup workflow

Cleanup workflow #3

Workflow file for this run

name: Continuous Integration
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
jobs:
deploy-preview:
name: GitHub Actions Test
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Get short commit hash
id: get_short_sha
run:
echo "short_sha=$(git rev-parse --short $GITHUB_SHA)" >>
$GITHUB_OUTPUT
- name: Test Local Action
id: test-action
uses: ./
with:
railway_api_token: ${{ secrets.RAILWAY_API_TOKEN }}
project_id: ${{ secrets.RAILWAY_PROJECT_ID }}
environment_name: production
preview_environment_name:
'pr-${{ github.event.number }}-${{
steps.get_short_sha.outputs.short_sha }}'
api_service_name: web
branch_name: ${{ github.head_ref }}
- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.service_domain }}"
cleanup:
runs-on: ubuntu-latest
if:
github.event.pull_request.merged == true ||
github.event.pull_request.state == 'closed'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get short commit hash
id: get_short_sha
run:
echo "short_sha=$(git rev-parse --short $GITHUB_SHA)" >>
$GITHUB_OUTPUT
- name: Cleanup Railway Environment
uses: ./
with:
railway_api_token: ${{ secrets.RAILWAY_API_TOKEN }}
project_id: ${{ secrets.RAILWAY_PROJECT_ID }}
preview_environment_name:
'pr-${{ github.event.number }}-${{
steps.get_short_sha.outputs.short_sha }}'
cleanup: 'true'