Skip to content

Commit

Permalink
Move copyright check out of PR action (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcamise-gpsw committed Apr 10, 2024
1 parent 76b890e commit 1bf0961
Show file tree
Hide file tree
Showing 4 changed files with 34 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,39 +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:
ref: ${{ steps.extract_branch.outputs.branch }}
ssh-key: ${{ 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 @@ -60,6 +27,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v3

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

Expand All @@ -71,7 +39,7 @@ jobs:
uses: actions/checkout@v3
with:
ref: release
ssh-key: ${{ secrets.PUSH_FROM_WORKFLOW_TO_RETRIGGER }}

- name: Verify synchronized if release
shell: bash
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish_python_sdk.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# publish_python_sdk.yml/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Wed, Sep 1, 2021 5:05:35 PM

name: Publish the Python SDK to PyPi

on:
Expand Down
2 changes: 2 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

// Something

0 comments on commit 1bf0961

Please sign in to comment.