updated country_count.yaml #21
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
# | ||
# Author: Hari Sekhon | ||
# Date: 2024-02-27 18:45:11 +0000 (Tue, 27 Feb 2024) | ||
# | ||
# vim:ts=2:sts=2:sw=2:et | ||
# | ||
# https://github.com/HariSekhon/Knowledge-Base | ||
# | ||
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback | ||
# | ||
# https://www.linkedin.com/in/HariSekhon | ||
# | ||
# ============================================================================ # | ||
# C o u n t r y C o u n t | ||
# ============================================================================ # | ||
# Update the Number of Countries count in the travel.md doc | ||
--- | ||
name: Country Count | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
paths: | ||
- travel.md | ||
- .github/scripts/country_count.sh | ||
- .github/workflows/country_count.yaml | ||
pull_request: | ||
branches: | ||
- master | ||
- main | ||
paths: | ||
- travel.md | ||
- .github/scripts/country_count.sh | ||
- .github/workflows/country_count.yaml | ||
workflow_dispatch: | ||
inputs: | ||
debug: | ||
# XXX: this still only works as a string comparison ${{ gitihub.events.inputs.debug == 'true' }} | ||
type: boolean | ||
required: false | ||
default: false | ||
permissions: | ||
contents: write | ||
concurrency: | ||
group: ${{ github.ref }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
defaults: | ||
run: | ||
shell: bash -euxo pipefail {0} | ||
env: | ||
GIT_AUTHOR_NAME: Hari Sekhon | ||
GIT_AUTHOR_EMAIL: ${{ env.GIT_AUTHOR_EMAIL }} | ||
Check failure on line 61 in .github/workflows/country_count.yaml GitHub Actions / Country CountInvalid workflow file
|
||
# inherited from repo environment variable to avoid GitHub redacting the git log | ||
# so I can see commit results correct before enabling committing | ||
#GIT_AUTHOR_EMAIL: ${{ secrets.git_author_email }} | ||
TRAVEL_MD: travel.md | ||
DEBUG: ${{ inputs.debug == true || github.event.inputs.debug == true || '' }} | ||
jobs: | ||
country_count: | ||
# github.event.repository context not available in scheduled workflows | ||
#if: github.event.repository.fork == false | ||
if: github.repository_owner == 'HariSekhon' | ||
name: Country Count | ||
timeout-minutes: 3 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Environment | ||
run: env | sort | ||
- uses: actions/checkout@v3 | ||
#name: Git Checkout # better to show the action@version | ||
with: | ||
submodules: 'true' # requires Git 2.18+ to be installed first | ||
- name: Update Country Count in ${{ env.TRAVEL_MD }} | ||
run: .github/scripts/country_count.sh | ||
- name: Git Add | ||
run: git add "$TRAVEL_MD" | ||
- name: Git Diff | ||
id: git-diff | ||
run: | | ||
set +e | ||
git diff-index HEAD | ||
# deprecated | ||
#echo "::set-output name=exit_status::$?" | ||
echo "exit_status=$?" >> "$GITHUB_STATE" | ||
- name: Set Git Config | ||
run: | | ||
git config user.name "$GIT_AUTHOR_NAME" | ||
git config user.email "$GIT_AUTHOR_EMAIL" | ||
- name: Git Commit | ||
if: ${{ steps.git-diff.outputs.exit_status != 0 }} | ||
run: git commit -m "updated country count" "$TRAVEL_MD" | ||
- name: Git Log | ||
run: git log -3 | ||
#- name: Git Push | ||
# run: git push |