Skip to content

Commit

Permalink
fixed output variables
Browse files Browse the repository at this point in the history
Signed-off-by: Jeromy Cannon <[email protected]>
  • Loading branch information
jeromy-cannon committed Apr 11, 2024
1 parent 97b3065 commit f30186d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/flow-update-readme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,28 @@ jobs:
- name: Readme Update Check
id: readme-update-check
run: |
# determine if any javascript files change since last "auto update README.md"
# determine if any javascript files changed
git --no-pager diff --name-only ${{ github.event.pull_request.head.ref }} $(git merge-base ${{ github.event.pull_request.head.ref }} ${{ github.event.pull_request.base.ref }})
CHANGED_FILES=$(git --no-pager diff --name-only ${{ github.event.pull_request.head.ref }} $(git merge-base ${{ github.event.pull_request.head.ref }} ${{ github.event.pull_request.base.ref }}) | grep -E -i ".*\.(mjs|cjs|js|package*\.json)")
[ "${#CHANGED_FILES}" -gt 0 ] && FILES_CHANGED=true || FILES_CHANGED=false
echo "FILES_CHANGED=$FILES_CHANGED"
# determine if commits since last "auto update README.md" commit
git --no-pager log --reverse --pretty="%H|%an|%s" ${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.ref }} | awk '/github-actions\[bot\]\|auto update README\.md/ {s=""; next} {s = s $0 RS} END {printf "%s", s}'
COMMITS_SINCE_UPDATE=$(git --no-pager log --reverse --pretty="%H|%an|%s" ${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.ref }} | awk '/github-actions\[bot\]\|auto update README\.md/ {s=""; next} {s = s $0 RS} END {printf "%s", s}')
[ "${#COMMITS_SINCE_UPDATE}" -gt 0 ] && UPDATE_NEEDED=true || UPDATED_NEEDED=false
echo "UPDATE_NEEDED=$UPDATE_NEEDED"
[ "${$FILES_CHANGED}" == "true" && "${UPDATE_NEEDED}" == "true"] && RUN_UPDATE=true || RUN_UPDATE=false
echo "run-update=$RUN_UPDATE" >> "${GITHUB_OUTPUT}"
- name: Setup Node
if: ${{ steps.readme-update-check.outputs.FILES_CHANGED == 'true' && steps.readme-update-check.outputs.UPDATE_NEEDED == 'true' }}
if: ${{ steps.readme-update-check.outputs.run-update }}
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
cache: npm

- name: Setup Kind
if: ${{ steps.readme-update-check.outputs.FILES_CHANGED == 'true' && steps.readme-update-check.outputs.UPDATE_NEEDED == 'true' }}
if: ${{ steps.readme-update-check.outputs.run-update }}
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
with:
install_only: true
Expand All @@ -67,7 +70,7 @@ jobs:
wait: 120s

- name: Install NVM & Dependencies
if: ${{ steps.readme-update-check.outputs.FILES_CHANGED == 'true' && steps.readme-update-check.outputs.UPDATE_NEEDED == 'true' }}
if: ${{ steps.readme-update-check.outputs.run-update }}
id: npm-deps
run: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
Expand All @@ -79,14 +82,14 @@ jobs:
npm ci
- name: Install gettext-base
if: ${{ steps.readme-update-check.outputs.FILES_CHANGED == 'true' && steps.readme-update-check.outputs.UPDATE_NEEDED == 'true' }}
if: ${{ steps.readme-update-check.outputs.run-update }}
id: gettext-base
run: |
sudo apt-get update
sudo apt-get install gettext-base
- name: Update README.md
if: ${{ steps.readme-update-check.outputs.FILES_CHANGED == 'true' && steps.readme-update-check.outputs.UPDATE_NEEDED == 'true' }}
if: ${{ steps.readme-update-check.outputs.run-update }}
run: |
npm install -g @hashgraph/solo
which solo
Expand Down Expand Up @@ -137,7 +140,7 @@ jobs:
egrep -v '↓|❯|•' README.md > README.md.tmp && mv README.md.tmp README.md
- name: Check README.md Changes
if: ${{ steps.readme-update-check.outputs.FILES_CHANGED == 'true' && steps.readme-update-check.outputs.UPDATE_NEEDED == 'true' }}
if: ${{ steps.readme-update-check.outputs.run-update }}
id: check-readme-changes
run: |
CHANGES=$(git diff --stat)
Expand All @@ -163,7 +166,7 @@ jobs:
# Signed Commits by actions https://github.com/actions/runner/issues/667
- name: Commit README.md Changes
if: ${{ steps.readme-update-check.outputs.FILES_CHANGED == 'true' && steps.readme-update-check.outputs.UPDATE_NEEDED == 'true' && steps.check-readme-changes.outputs.TOTAL_LINES_CHANGED > 20 }}
if: ${{ steps.readme-update-check.outputs.run-update && steps.check-readme-changes.outputs.TOTAL_LINES_CHANGED > 20 }}
uses: planetscale/[email protected]
with:
commit_message: "auto update README.md"
Expand Down

0 comments on commit f30186d

Please sign in to comment.