Continuous Integration Manifest Generation #292
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: 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" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
CI_COMMIT_MESSAGE: Continuous Integration Manifest Generation | |
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration | |
GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
if: env.GH_PUSH_TOKEN != '' | |
with: | |
token: ${{ env.GH_PUSH_TOKEN }} | |
# 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 |