CI Add New Company #28039
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
name: CI Add New Company | |
on: | |
push: | |
branches: | |
- gh-pages | |
schedule: | |
- cron: '0 7/1 * * *' | |
workflow_dispatch: | |
inputs: | |
name: | |
description: 'Why' | |
required: false | |
default: 'Because I want to check if there are new records' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current repo | |
uses: actions/checkout@v2 | |
- name: Get current directory and files | |
run: | | |
pwd | |
ls | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: '3.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax | |
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified | |
- name: Install Python Requirements | |
run: | | |
python --version | |
pip install -r assets/scripts/requirements.txt | |
- name: Download Records | |
run: | | |
python assets/scripts/add_new_company.py --token ${{ secrets.TYPEFORM_TOKEN }} | |
ls _data/companies/ | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git pull | |
git status | |
git add assets/scripts/add_new_company.history | |
git commit -m "update pr history" || echo "Nothing to update" | |
git push | |
git add . | |
commit_message=$(git diff --name-only --staged | tail -1) | |
# echo "COMPANY_NAME=$(cat $commit_message | grep name)" >> $GITHUB_ENV | |
# echo "COMPANY_BODY=$(cat $commit_message)" >> $GITHUB_ENV | |
git commit -m "new company" || echo "Nothing to update" | |
git status | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
title: New Company Request | |
body: "A new company has been requested. Check the files changed to see the details." | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch-suffix: short-commit-hash | |
- name: Check PR outputs | |
run: | | |
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}" | |
echo "Pull Request Number - ${{ steps.cpr.outputs.pr_number }}" |