diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 12a513b..f6e6762 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,25 +2,23 @@ # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file - version: 2 updates: -- package-ecosystem: pip - directory: "/" - schedule: - interval: daily - time: "13:00" - groups: - python-packages: - patterns: - - "*" - -- package-ecosystem: "gomod" - directory: "/" - schedule: - interval: daily - time: "13:00" - groups: - go-packages: - patterns: - - "*" + - package-ecosystem: pip + directory: "/" + schedule: + interval: daily + time: "13:00" + groups: + python-packages: + patterns: + - "*" + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: daily + time: "13:00" + groups: + go-packages: + patterns: + - "*" diff --git a/.github/golden-file-updater.yml b/.github/golden-file-updater.yml new file mode 100644 index 0000000..a5a0baf --- /dev/null +++ b/.github/golden-file-updater.yml @@ -0,0 +1,78 @@ +on: + push: + branches: [main] + paths-ignore: + - 'tests/*.golden' + - '**.md' + # Prevent triggering on automated commits +on: + push: + branches: [main] + paths-ignore: + - 'tests/*.golden' + - '**.md' + +jobs: + run-test: + if: "!contains(github.event.head_commit.message, '[skip ci]')" + runs-on: ubuntu-latest + # …rest of steps… + + +jobs: + run-test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./tests + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Run test_validate_url + id: test + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + pip install pytest requests + + - name: Run test_validate_url + run: | + pytest file_test.py::test_validate_url + + update-golden-files: + needs: run-test + if: needs.run-test.result == 'failure' + runs-on: ubuntu-latest + steps: + - name: Check out repository with full history + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate URL before fetching + run: | + # Test if URL is accessible + if ! curl --head --silent --fail "https://bsky.app/profile/witheringtales.bsky.social/post/3legkyuzjs22"; then + echo "URL not accessible, skipping golden file update" + exit 1 + fi + + - name: Get Golden File Content with retry + id: get_content + run: | + for i in {1..3}; do + response=$(curl -s --fail "https://bsky.app/profile/witheringtales.bsky.social/post/3legkyuzjs22") && break + echo "Attempt $i failed, retrying..." + sleep 5 + done + echo "response<> $GITHUB_OUTPUT + echo "$response" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT diff --git a/.github/workflows/document-formater.yml b/.github/workflows/document-formater.yml index bec4a2e..1fab787 100644 --- a/.github/workflows/document-formater.yml +++ b/.github/workflows/document-formater.yml @@ -1,10 +1,9 @@ name: Document Formatter on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] - + branches: [main] jobs: yaml-format: runs-on: ubuntu-latest @@ -21,5 +20,5 @@ jobs: git add . git commit -m 'Formatted YAML files' - name: Check for changes - run: | - git diff --exit-code \ No newline at end of file + run: |- + git diff --exit-code diff --git a/file.py b/file.py index d4a5972..30998ce 100644 --- a/file.py +++ b/file.py @@ -2,7 +2,6 @@ import csv import os -import sys from difflib import unified_diff import pandas as pd @@ -22,153 +21,31 @@ def validate_url(url: str) -> bool: - """Validate URL to ensure it is a valid URL. - - Args: - url (str): URL to validate. + """Validate URL to ensure it returns expected content. Returns: - bool: True if URL is valid, False otherwise. - + bool: True if URL returns expected content, False otherwise. """ - no_content_template = """ - - - - - - - - Bluesky - - - - - - - - - - - - - - - - - - - - - - - -
-
- - -
-
- -