Skip to content

refactor: detect if tool is running in a pull_request or push #187

refactor: detect if tool is running in a pull_request or push

refactor: detect if tool is running in a pull_request or push #187

Workflow file for this run

on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Run Deno tests
run: deno test --allow-env --allow-run --allow-read --allow-write --junit-path reports/junit.xml --coverage=reports/coverage/
- name: Generate coverage report
run: deno coverage --lcov --output=reports/coverage.lcov reports/coverage/
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: junit-results
path: reports/junit.xml
- name: Upload coverage for analysis
uses: coverallsapp/github-action@v2
with:
file: reports/coverage.lcov
env:
# try and speedup the action by homebrew not having to do more then it needs when installing the coveralls tool
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: true
- name: Annotate failed tests
if: always() # Run with test/lint failures.
uses: granodigital/[email protected]
with:
reports: |
junit|reports/junit.xml
test-it-runs:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' # Only run on PRs, otherwise we will trigger a deployment by accident.
permissions:
contents: read # only offer read permissions for dry-run to prevent accidental deployments
steps:
- uses: actions/checkout@v4
- name: Run deployment tool in dry-run mode
uses: ./
with:
version: ${{ github.sha }}
github_token: ${{ secrets.github_token }}
# Test that the config is read by the tool and pre-release versions are working.
analyze_commits_config: |
{
"branches": [
{ "branch_name": "${{ github.ref_name }}", "prerelease": true, "version_suffix": "test" }
]
}