Skip to content

Workflow file for this run

name: Add @base on Push
on: [push]
jobs:
check_commit:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.skip_check.outputs.skip }}
steps:
- name: Check out code
uses: actions/checkout@v2
- id: skip_check
run: |
MESSAGE=$(git log --format=%B -n 1)
if [[ "$MESSAGE" == *"[AUTO]"* ]]; then
echo "Commit message contains [AUTO]. Setting skip to true."
echo "::set-output name=skip::true"
else
echo "::set-output name=skip::false"
fi
update_ttl_files:
needs: check_commit
runs-on: ubuntu-latest
if: needs.check_commit.outputs.skip == 'false'
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Get changed files
id: getfile
run: |
files=$(git diff-tree --no-commit-id --name-only -r $(git log -n 1 --pretty=format:"%H") | grep ".ttl$")
echo "::set-output name=files::$files"
- name: Run Python script on changed files
run: |
IFS=' ' read -ra ADDR <<< "${{ steps.getfile.outputs.files }}"
for file in "${ADDR[@]}"; do
python add-base.py "$file"
- name: Configure Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<[email protected]>"
- name: Commit and Push changes
run: |
git add -u # Adds only modified files to the staging area
git commit -m "Updated .ttl files with base URI [AUTO]"
git push
done