DEV Community

Cover image for GitHub: Create your own repository landscape ⭐️

GitHub: Create your own repository landscape ⭐️

Tung Leo on April 28, 2024

Overview 👋 Do you want to create a central repository to showcase all your highlighted repositories with descriptions and stars? Somethi...
Collapse
 
cicirello profile image
Vincent A. Cicirello

You don't actually need a PAT to create a PR from a GitHub Actions workflow. The GITHUB_TOKEN is sufficient for PRs, with the right permissions.

Collapse
 
twisterrob profile image
Róbert Papp

Actually, it depends on your setup. Most repositories won't need a PAT and can use the default token generation. However if your repository has branch protection rules for the target branch and there's some CI, this won't work. Workflows can't trigger workflows is a basic rule in GHA. This means that if GITHUB_TOKEN opens a PR, the CI won't run on it. There are several workarounds: the simplest is to have the CI on pull_request: trigger and close+reopen the PR, because it's a human doing it, the CI will run. Another option is setting up a PAT so that the automated PR creation is "done by a human". In this case GHA can't distinguish between the workflow creating the PR or you manually, so CI will run as usual.

Collapse
 
tungbq profile image
Tung Leo

Thanks for your feedback, that's very useful for the understanding of the term "done by human" and the GitHub token permission point of view. I'll review this to see if I could make more improvements to my repository

Collapse
 
ccoveille profile image
Christophe Colombier

Thanks for confirming what I thought

Collapse
 
cicirello profile image
Vincent A. Cicirello

You're welcome

Collapse
 
tungbq profile image
Tung Leo

Yes, Thank you for suggesting this point @cicirello.
I will try to use the workflow with GITHUB_TOKEN and update the latest document in my repo once it’s working fine.

Collapse
 
tungbq profile image
Tung Leo • Edited

I updated this one in latest release: v0.4.0.
Via this PR github.com/tungbq/repos/pull/30
Thank you again @cicirello and @ccoveille for your feedback and suggestion!

Thread Thread
 
ccoveille profile image
Christophe Colombier

My pleasure

Collapse
 
cicirello profile image
Vincent A. Cicirello

You're welcome

Collapse
 
kaushal01 profile image
kaushal

Hi thank you for the tutorial but i am getting this error do u know why it could be or if u could help me with it thanks

Image description

Collapse
 
tungbq profile image
Tung Leo • Edited

Thank you for your feedback @kaushal01 !
I've switched the tooling to use GITHUB_TOKEN recently and update document on my repository, but this blog post is missing the new document.

It seems that you need to grant the GITHUB_TOKEN permission, please enable below option and re-try again.
Goto: https://github.com/YOUR_USERNAME/YOUR_REPO/settings/actions
(Repo > Setting > Action > General), in the Workflow permission section, enable following options:

  • Read and write permissions
  • Allow GitHub Actions to create and approve pull requests

gh-token-in-repo

I've mentioned this configuration in the section #2 in this post as well.

Collapse
 
kaushal01 profile image
kaushal

Thank you very much this works

Thread Thread
 
tungbq profile image
Tung Leo

You are welcome!

Collapse
 
ccoveille profile image
Christophe Colombier

Interesting project thanks.

Did you build this a part of a personal challenge? Or because you find nothing else to do it?

What were the existing alternative projects you considered ? if they are any

Collapse
 
tungbq profile image
Tung Leo

Hi @ccoveille, thanks for your feedback.
It’s built as part of my personal idea and experience to summarize and track my favorite projects in a central repository.

I’ve searched around but have not found similar project like this yet, so I just build my own and share to everyone who interested.
And yes if you find any similar projects like this please let me know. Thanks!

Collapse
 
ccoveille profile image
Christophe Colombier

Following discussion that happened in comments on @_michellemello post

I'm curious to know what @best_codes @clintonrocha98 @phalkmin think about @tungbq initiative and if you knew something equivalent or existing alternatives