title: github.GithubException.UnknownObjectException: 404 {"message": "Not Found",
body: <p>Full error:</p>
  <pre><code>File &quot;/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/github/Repository.py&quot;, line 2154, in update_file
      headers, data = self._requester.requestJsonAndCheck(
    File &quot;/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/github/Requester.py&quot;, line 353, in requestJsonAndCheck
      return self.__check(
    File &quot;/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/github/Requester.py&quot;, line 378, in __check
      raise self.__createException(status, responseHeaders, output)
  github.GithubException.UnknownObjectException: 404 {&quot;message&quot;: &quot;Not Found&quot;, &quot;documentation_url&quot;: &quot;https://docs.github.com/rest/reference/repos#create-or-update-file-contents&quot;}
  Error: Process completed with exit code 1.
  </code></pre>
  <p>I am trying to run a script from my github repo using github workflow which updates a file with new contents.</p>
  <p>Here is the code:</p>
  <pre><code>g = Github(token)
  repo = g.get_repo(repoName)
  oldFile = repo.get_contents(oldFilePath)
  repo.update_file(oldFile.path, &quot;update file&quot;, updatedFile, oldFile.sha, branch=&quot;main&quot;)
  </code></pre>
  <p>Note: The script, .yml workflow file, and the file being updated are all in the same repo. This same code runs smoothly when I run it on my local machine. But the error occurs when its running via Github workflow.</p>
  <p>.yml code:</p>
  <pre><code>- name: run .py file
      run: python script.py
  </code></pre>
  <p>Also note: The github token is accessed from the script with <code>os.environ.get(TOKEN_SECRET_NAME)</code></p>