Skip to content

refactor: setting continue variable #12

refactor: setting continue variable

refactor: setting continue variable #12

name: Format Libraries
on:
push:
branches:
- "main"
- "sg/automatic-formatting"
workflow_dispatch:
env:
COMMIT_MESSAGE: "chore: format libraries"
jobs:
check-message:
runs-on: ubuntu-latest
outputs:
continue: ${{ steps.check-message.continue }}
steps:
- name: Checkout Code
id: checkout
uses: actions/checkout@v4
- name: Check Message
id: check-message
run: |
if [[ "${{ github.event.head_commit.message }}" == "${{ env.COMMIT_MESSAGE }}" ]]; then
echo "Stop action"
export CONTINUE='false'
else
echo "Continue with action"
export CONTINUE='true'
fi
echo "continue=$CONTINUE" >> $GITHUB_OUTPUT
get-modified-libraries:
needs: check-message
runs-on: ubuntu-latest
steps:
- name: debug
id: debug
run: echo Continue is ${{ needs.check-message.outputs.continue }}
- name: Checkout Code
if: needs.check-message.outputs.continue == 'true'
id: checkout
uses: actions/checkout@v4
- name: Format Libraries
if: needs.check-message.outputs.continue == 'true'
id: format-libraries
run: |
bash ./create_library_lists.sh
- name: Commit
if: needs.check-message.outputs.continue == 'true'
id: commit
run: |
git status
git add .
git commit -m ${{ env.COMMIT_MESSAGE }}
git push