Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dco-check run as GH action fails after extensive rebase #111

Open
LiamClarkeNZ opened this issue Aug 5, 2021 · 3 comments
Open

dco-check run as GH action fails after extensive rebase #111

LiamClarkeNZ opened this issue Aug 5, 2021 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@LiamClarkeNZ
Copy link

Kia ora,

I added dco-check to GH, thank you for that, it's awesome :), and it flagged that a bunch of my commits weren't DCO compliant, so I rebased from scratch - e.g., git rebase -i --root. In the process, I not only reworded, but also squashed and dropped some commits.

This has now broken dco-check, as it seems to be trying to retrieve a commit that no longer exists.

The output:

Detected: GitHub CI

Checking commits: a33bba34234dcc2e98aaa9b5ad7b58211bba17b2..f0a6afac8d98e1c29a472fd929bf8721b5c81da2

  File "/opt/hostedtoolcache/Python/3.9.6/x64/bin/dco-check", line 8, in <module>
    sys.exit(main())
  File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/dco_check/dco_check.py", line 1128, in main
    commits = commit_retriever.get_commits(
  File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/dco_check/dco_check.py", line 939, in get_commits
    response = request.urlopen(req)
  File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

The actual commits, post rebase:

git log --oneline
f0a6afa (HEAD -> main, origin/main, origin/HEAD) Update README.md
4eb1370 Add DCO check
d928469 Automate assignment to GH project
1107a80 Added skeleton of first client app, and tried to codify project structure
02bd9d8 Initial commit

I'm assuming that state was stored by GH when dco-check cloned the repo, and this confused it. I took the following actions, one of which fixed it, unfortunately I didn't do it in a very scientific manner, my apologies.

  1. Renamed workflow file from dco.yml to DCO-check.yml
  2. Renamed action from "dco" to "DCO check" in the YAML
  3. Renamed the check step from "check DCO" to "DCO check"
@christophebedard
Copy link
Owner

Hey! Happy to hear it's helpful!

I'm assuming it was running after a push to main? Like you said, rebasing all your commits from the root probably confused GitHub and invalidated the before field in the event payload of the push event (https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push), and your actions probably "reset" it.

I'm not sure if this edge case can be covered using the data from the push event, but there might be a way to fall back on something else if the base commit isn't found when fetching data from the API. dco-check doesn't really expect a full/root rebase, and by default it tries not to check all commits from the root commit (at least for GitHub), but perhaps it would be the right behaviour here?

@LiamClarkeNZ
Copy link
Author

HI @christophebedard - It is indeed an edge case, might not need to be handled in code. I'd be happy to add some brief docs on it. If that works for you, I'd run some more isolated experiments to see which of the changes I made above resolved the issue, so can explain what to do if rebasing from --root and hitting this issue.

@christophebedard
Copy link
Owner

Of course, that would be great!

@christophebedard christophebedard added the documentation Improvements or additions to documentation label Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants