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

Investigate using custom actions for gh-pages publish of this org #3

Open
getify opened this issue Sep 19, 2024 · 2 comments
Open

Investigate using custom actions for gh-pages publish of this org #3

getify opened this issue Sep 19, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested

Comments

@getify
Copy link
Member

getify commented Sep 19, 2024

I'm aware of how to use custom github actions for publishing to gh-pages (via a .github/workflows like I'm doing here).

However, I'm not sure if that same approach can work here, where the repository itself is used as the main org gh-pages deployment.

What I would like to be able to do is dynamically generate the list of projects -- currently hard coded in the index.html from the list of pinned projects of this BYOJS org. I was imagining a custom github action that uses the github API to query the repository, get the list of pinned projects, then push in the generated HTML to the index.html. Perhaps even could use a simple templating engine, like Mustache.

But the first question to figure out is, can this special repo -- again, used as the org gh-pages deploy -- itself override its deployment with a custom gh-pages deployment? I haven't been able to find any documentation on whether this special case has such support, all the docs I found were either about doing custom actions for a normal repo, OR doing this special magic deployment of a repo for the org, not both together.

@getify getify added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested labels Sep 19, 2024
@QuantumAbraham
Copy link

What I would like to be able to do is dynamically generate the list of projects -- currently hard coded in the index.html from the list of pinned projects of this BYOJS org. I was imagining a custom github action that uses the github API to query the repository, get the list of pinned projects, then push in the generated HTML to the index.html. Perhaps even could use a simple templating engine, like Mustache.

Yes, it's possible to achieve this combination with a custom GitHub Action that both generates content dynamically and deploys to the gh-pages branch.

But the first question to figure out is, can this special repo -- again, used as the org gh-pages deploy -- itself override its deployment with a custom gh-pages deployment? I haven't been able to find any documentation on whether this special case has such support, all the docs I found were either about doing custom actions for a normal repo, OR doing this special magic deployment of a repo for the org, not both together.

Yes! As long as byojs repository is set to deploy from the gh-pages branch (or /docs folder in main), you can override the content with a github workflow. The custom workflow will generate and push new content to the same branch that GitHub Pages uses for deployment.

@QuantumAbraham
Copy link

Here's how we can approach it:
We can create a custom workflow (in .github/workflows) that triggers on push or a schedule (e.g., daily or weekly).
In the workflow, we use the GitHub API to query the organization’s pinned repositories.
Dynamically generate the content (e.g., an index.html) using a templating engine like Mustache or even just raw string manipulation.
Deployment to GitHub Pages:After generating the content, use the same GitHub Action to commit the updated index.html or other generated files back to the gh-pages branch.
GitHub Pages will automatically detect the update and deploy the site as usual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants