Skip to content

Merge branch 'dev-2.0' of https://github.com/geoschem/integrated_meth… #34

Merge branch 'dev-2.0' of https://github.com/geoschem/integrated_meth…

Merge branch 'dev-2.0' of https://github.com/geoschem/integrated_meth… #34

name: Build Shell Variable Manifest
# This github action automatically runs src/utilities/generate_var_manifest.py
# and commits the resulting src/components/shell_variable_manifest.md to the repo
on:
push:
branches:
- "dev"
- "dev-2.0"
jobs:
build:
runs-on: ubuntu-latest
env:
CI_COMMIT_MESSAGE: Continuous Integration Manifest Generation
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Set environment variables based on the last commit
- name: Set environment variable "commit-message"
run: echo "commit-message=$(git log -1 --pretty=format:'%s')" >> $GITHUB_ENV
- name: Display environment variable "commit-message"
run: echo "commit-message=${{ env.commit-message }}"
- name: Set environment variable "commit-author"
run: echo "commit-author=$(git log -1 --pretty=format:'%an')" >> $GITHUB_ENV
- name: Display environment variable "commit-author"
run: echo "commit-author=${{ env.commit-author }}"
- name: Set environment variable "is-auto-commit"
if: env.commit-message == env.CI_COMMIT_MESSAGE && env.commit-author == env.CI_COMMIT_AUTHOR
run: echo "is-auto-commit=true" >> $GITHUB_ENV
- name: Display environment variable "is-auto-commit"
run: echo "is-auto-commit=${{ env.is-auto-commit }}"
# Actually build the manifest
- name: Install Python dependencies
if: env.is-auto-commit == false
run: |
python -m pip install --upgrade pip pandas
python -m pip install --upgrade pip tabulate
- name: Generate shell variable manifest
if: env.is-auto-commit == false
run: |
python src/utilities/generate_var_manifest.py
# Commit generated manifest
- name: Display event name
run: echo "github.event_name=${{ github.event_name }}"
- name: GIT Commit and Push
# Don't run again on already pushed auto commit. Don't run on pull request events.
if: env.is-auto-commit == false
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "[email protected]"
git add src/components/shell_variable_manifest.md
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
git push