Skip to content

Commit

Permalink
comment workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
fzhao99 committed Dec 13, 2023
1 parent ea353ae commit 0573b6c
Show file tree
Hide file tree
Showing 14 changed files with 1,041 additions and 1,038 deletions.
66 changes: 33 additions & 33 deletions .github/workflows/checkForChanges.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
name: Check for Changes
# Reusable workflow, compatible with push and pull_request events
on:
workflow_call:
inputs:
# can be a file or a folder
what_to_check:
required: true
type: string
outputs:
has_changes:
description: true or false string
value: ${{ jobs.check_for_changes.outputs.has_changes }}
jobs:
check_for_changes:
runs-on: ubuntu-latest
outputs:
has_changes: ${{ steps.check_for_changes.outputs.has_changes }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- shell: bash
id: check_for_changes
run: |
echo "::group::Set has_changes output"
diff=$(git diff-tree --no-commit-id --name-only -r "origin/main" HEAD -- "${{ inputs.what_to_check }}")
echo "Diff: $diff"
diff_length=$(echo ${#diff})
has_diff=$([ $diff_length -gt 0 ] && echo "true" || echo "false")
echo "The Changes: ${has_diff}"
echo "has_changes=${has_diff}" >> "$GITHUB_OUTPUT"
echo "::endgroup::"
#name: Check for Changes
## Reusable workflow, compatible with push and pull_request events
#on:
# workflow_call:
# inputs:
# # can be a file or a folder
# what_to_check:
# required: true
# type: string
# outputs:
# has_changes:
# description: true or false string
# value: ${{ jobs.check_for_changes.outputs.has_changes }}
#jobs:
# check_for_changes:
# runs-on: ubuntu-latest
# outputs:
# has_changes: ${{ steps.check_for_changes.outputs.has_changes }}
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - shell: bash
# id: check_for_changes
# run: |
# echo "::group::Set has_changes output"
# diff=$(git diff-tree --no-commit-id --name-only -r "origin/main" HEAD -- "${{ inputs.what_to_check }}")
# echo "Diff: $diff"
# diff_length=$(echo ${#diff})
# has_diff=$([ $diff_length -gt 0 ] && echo "true" || echo "false")
# echo "The Changes: ${has_diff}"
# echo "has_changes=${has_diff}" >> "$GITHUB_OUTPUT"
# echo "::endgroup::"
118 changes: 59 additions & 59 deletions .github/workflows/checkGraphql.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
name: Check Graphql

on:
workflow_dispatch:
pull_request:
branches:
- "**"
merge_group:
types:
- checks_requested
push:
branches:
- main

env:
NODE_VERSION: 18

defaults:
run:
working-directory: frontend

jobs:
check-graphql-types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{env.NODE_VERSION}}
uses: actions/[email protected]
with:
node-version: ${{env.NODE_VERSION}}
- name: Cache yarn
uses: actions/[email protected]
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Node setup
run: yarn install --prefer-offline
- name: Generate grahpql types
run: yarn codegen
- name: Lint generated files
run: yarn lint:write
- name: Check for changes
run: |
if [[ -z "$(git status --porcelain)" ]]; then
exit 0
else
echo "Current generated code does not match code in latest commit. try running cd frontend/ && yarn codegen"
git diff >> diff.txt
exit 1
fi
- name: Archive git diff
uses: actions/upload-artifact@v3
if: failure()
with:
name: files changed
path: frontend/diff.txt
retention-days: 7
#name: Check Graphql
#
#on:
# workflow_dispatch:
# pull_request:
# branches:
# - "**"
# merge_group:
# types:
# - checks_requested
# push:
# branches:
# - main
#
#env:
# NODE_VERSION: 18
#
#defaults:
# run:
# working-directory: frontend
#
#jobs:
# check-graphql-types:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Use Node.js ${{env.NODE_VERSION}}
# uses: actions/[email protected]
# with:
# node-version: ${{env.NODE_VERSION}}
# - name: Cache yarn
# uses: actions/[email protected]
# with:
# path: ~/.cache/yarn
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-yarn-
# - name: Node setup
# run: yarn install --prefer-offline
# - name: Generate grahpql types
# run: yarn codegen
# - name: Lint generated files
# run: yarn lint:write
# - name: Check for changes
# run: |
# if [[ -z "$(git status --porcelain)" ]]; then
# exit 0
# else
# echo "Current generated code does not match code in latest commit. try running cd frontend/ && yarn codegen"
# git diff >> diff.txt
# exit 1
# fi
# - name: Archive git diff
# uses: actions/upload-artifact@v3
# if: failure()
# with:
# name: files changed
# path: frontend/diff.txt
# retention-days: 7
128 changes: 64 additions & 64 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
name: Chromatic

on:
workflow_dispatch:
pull_request:
branches:
- "**"
paths:
- "frontend/**"
push:
branches:
- main
paths:
- "frontend/**"

env:
NODE_VERSION: 18

jobs:
chromatic-deployment:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4
with:
fetch-depth: 0 # Chromatic wants the history

- uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: yarn
working-directory: frontend

- name: Publish to Chromatic
if: github.ref != 'refs/heads/main'
uses: chromaui/action@v10
with:
workingDir: frontend
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
ignoreLastBuildOnBranch: "**" # Better comparisons after rebasing
exitZeroOnChanges: true
exitOnceUploaded: true

- name: Publish to Chromatic (auto-accept changes on merge main)
if: github.ref == 'refs/heads/main'
uses: chromaui/action@v10
with:
workingDir: frontend
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
ignoreLastBuildOnBranch: "**"
exitZeroOnChanges: true
exitOnceUploaded: true
autoAcceptChanges: true # handle squash-on-merge

- name: Artifact Chromatic logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: logs
path: frontend/*.log
#name: Chromatic
#
#on:
# workflow_dispatch:
# pull_request:
# branches:
# - "**"
# paths:
# - "frontend/**"
# push:
# branches:
# - main
# paths:
# - "frontend/**"
#
#env:
# NODE_VERSION: 18
#
#jobs:
# chromatic-deployment:
# runs-on: ubuntu-latest
# steps:
#
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0 # Chromatic wants the history
#
# - uses: actions/[email protected]
# with:
# node-version: ${{ env.NODE_VERSION }}
#
# - name: Install dependencies
# run: yarn
# working-directory: frontend
#
# - name: Publish to Chromatic
# if: github.ref != 'refs/heads/main'
# uses: chromaui/action@v10
# with:
# workingDir: frontend
# token: ${{ secrets.GITHUB_TOKEN }}
# projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
# ignoreLastBuildOnBranch: "**" # Better comparisons after rebasing
# exitZeroOnChanges: true
# exitOnceUploaded: true
#
# - name: Publish to Chromatic (auto-accept changes on merge main)
# if: github.ref == 'refs/heads/main'
# uses: chromaui/action@v10
# with:
# workingDir: frontend
# token: ${{ secrets.GITHUB_TOKEN }}
# projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
# ignoreLastBuildOnBranch: "**"
# exitZeroOnChanges: true
# exitOnceUploaded: true
# autoAcceptChanges: true # handle squash-on-merge
#
# - name: Artifact Chromatic logs
# if: failure()
# uses: actions/upload-artifact@v3
# with:
# name: logs
# path: frontend/*.log
Loading

0 comments on commit 0573b6c

Please sign in to comment.