Skip to content

Commit

Permalink
workflows: proper loading of wikiupdater secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
FFHener committed Feb 11, 2024
1 parent dbdbc75 commit 06a012d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/wikiupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on: # yamllint disable-line rule:truthy
- master

jobs:
update:
update_wiki:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -27,6 +27,9 @@ jobs:
echo "CHANGED_LOCATIONS=$CHANGED_LOCATIONS" >> "$GITHUB_ENV"
- name: Update wiki.freifunk.net
env:
FF_WIKI_USER: ${{ vars.FF_WIKI_USER }}
FF_WIKI_PASSWORD: ${{ secrets.FF_WIKI_PASSWORD }}
run: |
if [ -n "${CHANGED_LOCATIONS}" ]; then
ansible-playbook play.yml --tags wiki --limit "$CHANGED_LOCATIONS" ||true
Expand Down
10 changes: 7 additions & 3 deletions roles/cfg_openwrt/files/wiki/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@
# CONFIG #
############

if not load_dotenv(".env"):
# Load .env file if it exists
load_dotenv(".env")

# Check if the environment variables are set
if not os.getenv("FF_WIKI_USER") or not os.getenv("FF_WIKI_PASSWORD"):
raise FileNotFoundError(
(
"No .env file found. Please make shure you used example.env as a template"
"and filled in your personal credentials."
"Environment variables FF_WIKI_USER and FF_WIKI_PASSWORD are not set. "
"Please ensure they are set in the GitHub Settings or in your local .env file."
)
)

Expand Down

0 comments on commit 06a012d

Please sign in to comment.