mirror of
https://github.com/ivuorinen/ghaw-auditor.git
synced 2026-03-20 20:03:10 +00:00
feat: initial commit
This commit is contained in:
23
tests/fixtures/action-with-defaults.yml
vendored
Normal file
23
tests/fixtures/action-with-defaults.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
name: 'Action with Various Defaults'
|
||||
description: 'Tests different input default types'
|
||||
|
||||
inputs:
|
||||
string-input:
|
||||
description: 'String input'
|
||||
default: 'hello'
|
||||
boolean-input:
|
||||
description: 'Boolean input'
|
||||
default: true
|
||||
number-input:
|
||||
description: 'Number input'
|
||||
default: 42
|
||||
no-default:
|
||||
description: 'Input without default'
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- run: echo "test"
|
||||
shell: bash
|
||||
12
tests/fixtures/basic-workflow.yml
vendored
Normal file
12
tests/fixtures/basic-workflow.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
name: Basic Workflow
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run tests
|
||||
run: echo "Testing"
|
||||
89
tests/fixtures/complex-workflow.yml
vendored
Normal file
89
tests/fixtures/complex-workflow.yml
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
---
|
||||
name: Complex Workflow
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull_requests: write
|
||||
|
||||
env:
|
||||
NODE_ENV: production
|
||||
API_URL: https://api.example.com
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: ./src
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
permissions:
|
||||
contents: read
|
||||
environment:
|
||||
name: production
|
||||
url: https://example.com
|
||||
env:
|
||||
BUILD_ENV: production
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build
|
||||
run: npm run build
|
||||
env:
|
||||
API_KEY: ${{ secrets.API_KEY }}
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name == 'pull_request'
|
||||
container:
|
||||
image: node:20-alpine
|
||||
credentials:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASS }}
|
||||
env:
|
||||
NODE_ENV: test
|
||||
ports:
|
||||
- 8080
|
||||
volumes:
|
||||
- /tmp:/tmp
|
||||
options: --cpus 2
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15
|
||||
credentials:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASS }}
|
||||
env:
|
||||
POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
||||
ports:
|
||||
- 5432
|
||||
options: --health-cmd pg_isready
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18, 20]
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
fail-fast: false
|
||||
max-parallel: 2
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Test
|
||||
run: npm test
|
||||
env:
|
||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||
33
tests/fixtures/composite-action.yml
vendored
Normal file
33
tests/fixtures/composite-action.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
name: 'Composite Action'
|
||||
description: 'A composite action example'
|
||||
author: 'Test Author'
|
||||
|
||||
inputs:
|
||||
message:
|
||||
description: 'Message to display'
|
||||
required: true
|
||||
debug:
|
||||
description: 'Enable debug mode'
|
||||
required: false
|
||||
default: 'false'
|
||||
|
||||
outputs:
|
||||
result:
|
||||
description: 'Action result'
|
||||
value: ${{ steps.output.outputs.result }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Display message
|
||||
run: echo "${{ inputs.message }}"
|
||||
shell: bash
|
||||
- name: Set output
|
||||
id: output
|
||||
run: echo "result=success" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
branding:
|
||||
icon: 'check'
|
||||
color: 'green'
|
||||
21
tests/fixtures/docker-action.yml
vendored
Normal file
21
tests/fixtures/docker-action.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
name: 'Docker Action'
|
||||
description: 'A Docker action example'
|
||||
|
||||
inputs:
|
||||
dockerfile:
|
||||
description: 'Path to Dockerfile'
|
||||
required: false
|
||||
default: 'Dockerfile'
|
||||
|
||||
outputs:
|
||||
image-id:
|
||||
description: 'Built image ID'
|
||||
|
||||
runs:
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
args:
|
||||
- ${{ inputs.dockerfile }}
|
||||
env:
|
||||
BUILD_ENV: production
|
||||
11
tests/fixtures/empty-workflow-call.yml
vendored
Normal file
11
tests/fixtures/empty-workflow-call.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
name: Empty Workflow Call
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
1
tests/fixtures/invalid-action.yml
vendored
Normal file
1
tests/fixtures/invalid-action.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# Empty action file
|
||||
1
tests/fixtures/invalid-workflow.yml
vendored
Normal file
1
tests/fixtures/invalid-workflow.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# Empty file
|
||||
27
tests/fixtures/javascript-action.yml
vendored
Normal file
27
tests/fixtures/javascript-action.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: 'JavaScript Action'
|
||||
description: 'A Node.js action example'
|
||||
author: 'GitHub'
|
||||
|
||||
inputs:
|
||||
token:
|
||||
description: 'GitHub token'
|
||||
required: true
|
||||
timeout:
|
||||
description: 'Timeout in seconds'
|
||||
required: false
|
||||
default: '60'
|
||||
|
||||
outputs:
|
||||
status:
|
||||
description: 'Action status'
|
||||
|
||||
runs:
|
||||
using: node20
|
||||
main: dist/index.js
|
||||
pre: dist/setup.js
|
||||
post: dist/cleanup.js
|
||||
|
||||
branding:
|
||||
icon: 'code'
|
||||
color: 'blue'
|
||||
27
tests/fixtures/job-with-outputs.yml
vendored
Normal file
27
tests/fixtures/job-with-outputs.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: Job with Outputs
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
artifact-url: ${{ steps.upload.outputs.url }}
|
||||
status: success
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Get version
|
||||
id: version
|
||||
run: echo "version=1.0.0" >> $GITHUB_OUTPUT
|
||||
- name: Upload artifact
|
||||
id: upload
|
||||
run: echo "url=https://example.com/artifact" >> $GITHUB_OUTPUT
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Deploy
|
||||
run: echo "Deploying version ${{ needs.build.outputs.version }}"
|
||||
26
tests/fixtures/reusable-workflow-caller.yml
vendored
Normal file
26
tests/fixtures/reusable-workflow-caller.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
name: Reusable Workflow Caller
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
call-workflow:
|
||||
uses: owner/repo/.github/workflows/deploy.yml@v1
|
||||
with:
|
||||
environment: production
|
||||
debug: false
|
||||
version: 1.2.3
|
||||
secrets:
|
||||
deploy-token: ${{ secrets.DEPLOY_TOKEN }}
|
||||
api-key: ${{ secrets.API_KEY }}
|
||||
|
||||
call-workflow-inherit:
|
||||
uses: owner/repo/.github/workflows/test.yml@main
|
||||
secrets: inherit
|
||||
|
||||
call-local-workflow:
|
||||
uses: ./.github/workflows/shared.yml
|
||||
with:
|
||||
config: custom
|
||||
39
tests/fixtures/reusable-workflow.yml
vendored
Normal file
39
tests/fixtures/reusable-workflow.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: Reusable Workflow
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
environment:
|
||||
description: 'Deployment environment'
|
||||
required: true
|
||||
type: string
|
||||
debug:
|
||||
description: 'Enable debug mode'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
outputs:
|
||||
deployment-id:
|
||||
description: 'Deployment ID'
|
||||
value: ${{ jobs.deploy.outputs.id }}
|
||||
secrets:
|
||||
deploy-token:
|
||||
description: 'Deployment token'
|
||||
required: true
|
||||
api-key:
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
id: ${{ steps.deploy.outputs.id }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Deploy
|
||||
id: deploy
|
||||
run: echo "id=12345" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
TOKEN: ${{ secrets.deploy-token }}
|
||||
API_KEY: ${{ secrets.api-key }}
|
||||
Reference in New Issue
Block a user