Python sdk maintenance #318
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pre_merge_checks.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 | |
# 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 | |
on: | |
pull_request: | |
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: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Log in to the Container registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
- name: Test Jekyll Build and Check Links | |
run: make tests | |
ensure_synchronization: | |
if: github.repository != 'gopro/OpenGoPro' && github.base_ref == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source branch | |
uses: actions/checkout@v3 | |
with: | |
ref: release | |
ssh-key: ${{ secrets.PUSH_FROM_WORKFLOW_TO_RETRIGGER }} | |
- name: Verify synchronized if release | |
shell: bash | |
run: | | |
hash=$( git rev-parse HEAD | cut -c1-7) | |
target_hash=$(git ls-remote [email protected]:gopro/OpenGoPro U main | cut -c1-7) | |
echo "Target hash is $target_hash" | |
echo "release hash is $hash" | |
if [[ $hash == $target_hash ]]; then | |
exit 0 | |
else | |
echo "release branch is not synchronized with external main" | |
exit 1 | |
fi |