Skip to content

Commit

Permalink
Move copyright out of pre merge check
Browse files Browse the repository at this point in the history
  • Loading branch information
tcamise-gpsw committed Apr 10, 2024
1 parent 73284ea commit 0080c75
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 38 deletions.
31 changes: 27 additions & 4 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,30 @@ on:
workflow_dispatch:

jobs:
copyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Check for (and add) missing copyrights
shell: bash
run: |
make copyright
echo "NUM_MODIFIED=$(git diff --numstat | wc -l)" >> $GITHUB_ENV
- name: Push changes
if: env.NUM_MODIFIED != 0
shell: bash
run: |
git config core.fileMode false
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "updating copyrights from pre merge check in github action"
git push -f origin HEAD:${GITHUB_HEAD_REF_NAME}
check:
needs: copyright
name: Check modified files for Python SDK changes
runs-on: ubuntu-latest
outputs:
Expand All @@ -29,16 +52,16 @@ jobs:
git diff --name-only HEAD^ HEAD >files.txt
while IFS= read -r file; do
if [[ $file != demos/python/sdk_wireless_camera_control* ]]; then
echo "::set-output name=run_job::false"
echo "{run_job}={false}" >> $GITHUB_OUTPUT
else
echo "Found a Python SDK modified file"
echo "::set-output name=run_job::true"
echo "{run_job}={true}" >> $GITHUB_OUTPUT
break
fi
done <files.txt
python_sdk:
name: Build and Deploy Python SDK
name: Build and Deploy Python SDK Documentation
needs: check
if: needs.check.outputs.run_job == 'true'
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -104,7 +127,7 @@ jobs:
jekyll:
name: Build and Deploy Jekyll Site
needs: [check, python_sdk]
needs: [copyright, check, python_sdk]
if: always()
runs-on: ubuntu-latest
steps:
Expand Down
36 changes: 2 additions & 34 deletions .github/workflows/pre_merge_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# This copyright was auto-generated on Wed, Sep 1, 2021 5:05:35 PM

# This workflow will run pre-merge checks to verify a PR before it is merged:
# - copyright: Checks to see if there are any missing copyrights

name: Pre Merge Checks

Expand All @@ -11,40 +10,7 @@ on:
branches: [main, develop, release]

jobs:
copyright:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_HEAD_REF#refs/heads/})"
id: extract_branch

- name: Checkout PR branch
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ steps.extract_branch.outputs.branch }}
token: ${{ secrets.PUSH_FROM_WORKFLOW_TO_RETRIGGER }}

- name: Check for (and add) missing copyrights
shell: bash
run: |
make copyright
echo "NUM_MODIFIED=$(git diff --numstat | wc -l)" >> $GITHUB_ENV
- name: Push changes
if: env.NUM_MODIFIED != 0
shell: bash
run: |
git config core.fileMode false
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "updating copyrights from pre merge check in github action"
git push -f origin HEAD:${{ steps.extract_branch.outputs.branch }}
test_github_pages:
needs: copyright
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
Expand All @@ -61,6 +27,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v3

- name: Test Jekyll Build and Check Links
run: make tests

Expand All @@ -72,6 +39,7 @@ jobs:
uses: actions/checkout@v3
with:
ref: release

- name: Verify synchronized if release
shell: bash
run: |
Expand Down

0 comments on commit 0080c75

Please sign in to comment.