Skip to content

Merge pull request #1 from step-security/release #6

Merge pull request #1 from step-security/release

Merge pull request #1 from step-security/release #6

Workflow file for this run

name: Tests
on:
push:
branches: [ main ]
paths:
- 'dist/*.js'
- '.github/workflows/tests.yml'
pull_request:
branches: [ main ]
jobs:
test-specific-version:
name: Test Specific Version
strategy:
matrix:
version: [ '2.26.1', '2.49.0' ]
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: step-security/setup-gh-cli-action@main
if: ${{ github.event_name == 'push' }}
id: install-gh-main
with:
version: ${{ matrix.version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
id: install-gh-local
with:
version: ${{ matrix.version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- id: install-gh
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
BRANCH_INSTALLED_VERSION: ${{ steps.install-gh-main.outputs.installed-version }}
LOCAL_INSTALLED_VERSION: ${{ steps.install-gh-local.outputs.installed-version }}
run: |
if [ "${EVENT_NAME}" == 'push' ]; then
echo "installed-version=${BRANCH_INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
else
echo "installed-version=${LOCAL_INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
fi
- name: Check installed version
env:
REQUESTED_VERSION: ${{ matrix.version }}
INSTALLED_VERSION: ${{ steps.install-gh.outputs.installed-version }}
shell: bash
run: |
gh version | grep -q "${REQUESTED_VERSION}"
gh version | grep -q "${INSTALLED_VERSION}"
test-rolling-version:
name: Test Rolling Version
strategy:
matrix:
version: [ 'stable', 'latest' ]
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: step-security/setup-gh-cli-action@main
if: ${{ github.event_name == 'push' }}
id: install-gh-main
with:
version: ${{ matrix.version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
id: install-gh-local
with:
version: ${{ matrix.version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- id: install-gh
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
BRANCH_INSTALLED_VERSION: ${{ steps.install-gh-main.outputs.installed-version }}
LOCAL_INSTALLED_VERSION: ${{ steps.install-gh-local.outputs.installed-version }}
run: |
if [ "${EVENT_NAME}" == 'push' ]; then
echo "installed-version=${BRANCH_INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
else
echo "installed-version=${LOCAL_INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
fi
- name: Check installed version
shell: bash
env:
REQUESTED_VERSION: ${{ matrix.version }}
INSTALLED_VERSION: ${{ steps.install-gh.outputs.installed-version }}
run: gh version | grep -q "${INSTALLED_VERSION}"
test-no-token:
name: Test without token
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: step-security/setup-gh-cli-action@main
if: ${{ github.event_name == 'push' }}
id: install-gh-main
with:
version: stable
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
id: install-gh-local
with:
version: stable
- id: install-gh
env:
EVENT_NAME: ${{ github.event_name }}
BRANCH_INSTALLED_VERSION: ${{ steps.install-gh-main.outputs.installed-version }}
LOCAL_INSTALLED_VERSION: ${{ steps.install-gh-local.outputs.installed-version }}
shell: bash
run: |
if [ "${EVENT_NAME}" == 'push' ]; then
echo "installed-version=${BRANCH_INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
else
echo "installed-version=${LOCAL_INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
fi
- name: Check installed version
shell: bash
env:
INSTALLED_VERSION: ${{ steps.install-gh.outputs.installed-version }}
run: gh version | grep -q "${INSTALLED_VERSION}"