"Author XXX Does Not Exist" When Running In GitHub Actions
Resolving "Author XXX does not exist" Error in GitHub Actions with pygscholar
As a researcher, creating monthly reports of publications is an essential task. For several years, we have been using the scholarly package in GitHub Actions to automate this process. However, with the recent breaking change in Google Scholar, we started looking for an alternative. This is where we discovered pygscholar, a promising package that has a fix for the recent change in Google Scholar. In this article, we will explore how to resolve the "Author XXX does not exist" error when running pygscholar in GitHub Actions.
For those who may not be familiar, scholarly is a Python package that allows users to interact with Google Scholar. It has been a popular choice for researchers and developers alike. However, with the recent lack of maintenance and updates, we started looking for alternative solutions. pygscholar, on the other hand, is a relatively new package that has gained attention for its ability to handle the recent breaking change in Google Scholar.
When running pygscholar locally, everything works as expected. However, when running it in GitHub Actions, we encounter the following error:
$ scholar add-author "Leonid Kostrykin" --scholar-id=Ht5mGwoAAAAJ
Author Leonid Kostrykin does not exist.
This error is frustrating, especially when we know that the author exists and the command works perfectly when run locally.
After some investigation, we discovered that the issue is related to the way GitHub Actions handles the environment. Specifically, the SCHOLAR_USER_AGENT
environment variable is not set correctly in GitHub Actions. This variable is required by pygscholar to interact with Google Scholar.
To resolve this issue, we need to set the SCHOLAR_USER_AGENT
environment variable in our GitHub Actions workflow. We can do this by adding the following line to our workflow file:
name: pygscholar
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set environment variables
run: |
export SCHOLAR_USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.3"
- name: Install dependencies
run: |
pip install pygscholar
- name: Run pygscholar
run: |
scholar add-author "Leonid Kostrykin" --scholar-id=Ht5mGwoAAAAJ
By setting the SCHOLAR_USER_AGENT
environment variable, we can resolve the "Author XXX does not exist" error and run pygscholar successfully in GitHub Actions.
In this article, we explored the "Author XXX does not exist" error when running pygscholar in GitHub Actions. We discovered that the issue is related to the GitHub Actions handles the environment and that setting the SCHOLAR_USER_AGENT
environment variable resolves the issue. By following the steps outlined in this article, researchers and developers can successfully run pygscholar in GitHub Actions and automate their publication reports.
- Make sure to update your GitHub Actions workflow file to include the
SCHOLAR_USER_AGENT
environment variable. - If you are using a different package or library, make sure to check the documentation for any specific environment variables that may be required.
- If you are still encountering issues, try debugging your workflow file to identify any other potential issues.
- scholarly
- pygscholar
- GitHub Actions
pygscholar Q&A: Resolving Common Issues and Best Practices
In our previous article, we explored the "Author XXX does not exist" error when running pygscholar in GitHub Actions. We discovered that setting the SCHOLAR_USER_AGENT
environment variable resolves the issue. However, we know that there are many more questions and concerns when it comes to using pygscholar. In this article, we will answer some of the most frequently asked questions and provide best practices for using pygscholar.
Q: What is pygscholar and how does it differ from scholarly?
A: pygscholar is a Python package that allows users to interact with Google Scholar. It is designed to be a drop-in replacement for scholarly, but with additional features and improvements. pygscholar has a fix for the recent breaking change in Google Scholar, making it a more reliable choice for researchers and developers.
Q: How do I install pygscholar?
A: You can install pygscholar using pip:
pip install pygscholar
Q: What are the system requirements for pygscholar?
A: pygscholar requires Python 3.6 or later and the requests
library. It also requires the SCHOLAR_USER_AGENT
environment variable to be set.
Q: How do I set the SCHOLAR_USER_AGENT
environment variable?
A: You can set the SCHOLAR_USER_AGENT
environment variable in your GitHub Actions workflow file or in your local environment. Here is an example of how to set it in a GitHub Actions workflow file:
name: pygscholar
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set environment variables
run: |
export SCHOLAR_USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.3"
- name: Install dependencies
run: |
pip install pygscholar
- name: Run pygscholar
run: |
scholar add-author "Leonid Kostrykin" --scholar-id=Ht5mGwoAAAAJ
Q: How do I use pygscholar to add an author?
A: You can use the add-author
command to add an author to your publication list. Here is an example:
scholar add-author "Leonid Kostrykin" --scholar-id=Ht5mGwoAAAAJ
Q: How do I use pygscholar to get a list of authors?
A: You can use the get-authors
command to get a list of authors. Here is an example:
scholar get-authors
Q: How do I use pygscholar to get a list of publications?
A: You can use the get-publications
command to get a list of publications. Here is an example:
scholar get-publications
: How do I use pygscholar to get a list of citations?
A: You can use the get-citations
command to get a list of citations. Here is an example:
scholar get-citations
Q: How do I use pygscholar to get a list of co-authors?
A: You can use the get-co-authors
command to get a list of co-authors. Here is an example:
scholar get-co-authors
Q: How do I use pygscholar to get a list of co-publications?
A: You can use the get-co-publications
command to get a list of co-publications. Here is an example:
scholar get-co-publications
In this article, we answered some of the most frequently asked questions and provided best practices for using pygscholar. We hope that this article has been helpful in resolving common issues and improving your experience with pygscholar. If you have any further questions or concerns, please don't hesitate to reach out.
- Make sure to update your GitHub Actions workflow file to include the
SCHOLAR_USER_AGENT
environment variable. - If you are using a different package or library, make sure to check the documentation for any specific environment variables that may be required.
- If you are still encountering issues, try debugging your workflow file to identify any other potential issues.