Skip to content

Commit

Permalink
try debug what's wrong with Registry.toml file (JuliaRegistries#354)
Browse files Browse the repository at this point in the history
* try debug what's wrong with Registry.toml file

* Update repo.py

* add log

* Create tagbot.yml
  • Loading branch information
IanButterworth authored Sep 23, 2024
1 parent 4820024 commit 220ae9d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .github/workflows/tagbot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: TagBot
on:
issue_comment:
types:
- created
workflow_dispatch:
inputs:
lookback:
default: "3"
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Edit the following line to reflect the actual name of the GitHub Secret containing your private key
ssh: ${{ secrets.DOCUMENTER_KEY }}
# ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }}
14 changes: 13 additions & 1 deletion tagbot/action/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def __init__(
except Exception:
# This is an awful hack to let me avoid properly fixing the tests...
if "pytest" in sys.modules:
logger.warning("'awful hack' in use")
self._registry = self._gh.get_repo(registry, lazy=True)
self._clone_registry = False
else:
Expand Down Expand Up @@ -155,7 +156,18 @@ def _registry_path(self) -> Optional[str]:
registry = toml.load(f)
else:
contents = self._only(self._registry.get_contents("Registry.toml"))
registry = toml.loads(contents.decoded_content.decode())
# show file contents if cannot be decoded
try:
string_contents = contents.decoded_content.decode()
except AssertionError:
logger.info(
f"Registry.toml could not be decoded. Raw contents: {contents}"
)
# rethrow now we've logged info
raise

registry = toml.loads(string_contents)

if uuid in registry["packages"]:
self.__registry_path = registry["packages"][uuid]["path"]
return self.__registry_path
Expand Down

0 comments on commit 220ae9d

Please sign in to comment.