Skip to content

Merge pull request #32 from brtrick/main #97

Merge pull request #32 from brtrick/main

Merge pull request #32 from brtrick/main #97

Workflow file for this run

name: Test
on:
pull_request:
push:
branches:
- main
jobs:
debug:
name: Debug
runs-on: ubuntu-latest
steps:
- name: Print environment variables
run: env
- name: Print events.json
run: cat "$GITHUB_EVENT_PATH"
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: |
yarn
- name: Clean, build, format, lint, package, and test
run: |
yarn all
- name: Check if packaged properly
run: |
# If there are any unstaged or untracked files in 'dist/', then the action wasn't packaged properly
if git diff --name-only | grep '^dist/' || git ls-files --other --exclude-standard | grep '^dist/'; then
echo "You didn't package the action properly before pushing to remote." \
echo "Always run 'yarn all' before staging a commit."
echo "Below are the modified files in 'dist/' after running 'yarn && rm -rf dist/ && yarn all':"
git diff --name-only | grep '^dist/'
git ls-files --other --exclude-standard | grep '^dist/'
exit 1
fi
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: files
uses: ./
name: Run the action without filtering
- name: Print files
run: |
echo 'steps.files.outputs.all=${{ steps.files.outputs.all }}'
echo 'steps.files.outputs.added=${{ steps.files.outputs.added }}'
echo 'steps.files.outputs.modified=${{ steps.files.outputs.modified }}'
echo 'steps.files.outputs.removed=${{ steps.files.outputs.removed }}'
echo 'steps.files.outputs.renamed=${{ steps.files.outputs.renamed }}'
echo 'steps.files.outputs.added_modified=${{ steps.files.outputs.added_modified }}'
echo 'steps.files.outputs.added_modified_renamed=${{ steps.files.outputs.added_modified_renamed }}'
- id: files-filtered
name: Run the action with filtering
uses: ./
with:
filter: |
*.yml
!.github/*/*.yml
*.js
*.ts
package*
!*.json
- name: Print files-filtered
run: |
echo 'steps.files-filtered.outputs.all=${{ steps.files-filtered.outputs.all }}'
echo 'steps.files-filtered.outputs.added=${{ steps.files-filtered.outputs.added }}'
echo 'steps.files-filtered.outputs.modified=${{ steps.files-filtered.outputs.modified }}'
echo 'steps.files-filtered.outputs.removed=${{ steps.files-filtered.outputs.removed }}'
echo 'steps.files-filtered.outputs.renamed=${{ steps.files-filtered.outputs.renamed }}'
echo 'steps.files-filtered.outputs.added_modified=${{ steps.files-filtered.outputs.added_modified }}'
echo 'steps.files-filtered.outputs.added_modified_renamed=${{ steps.files-filtered.outputs.added_modified_renamed }}'