Is there a way to set repo settings inside a file so that GitHub displays them on the main page?
Input (e.g. .github.yaml in main branch)
Output (repo main page)
meta_data: description: JDK main-line development website: https://openjdk.org/projects/jdk topics: [ java, jvm, openjdk ]
I'm looking for an answer without calling GitHub APIs.
I'm looking for an answer without calling GitHub APIs.
And yet, a call to updating a repository API would certainly be involved, through a GitHub Action.
You can setup such an action triggered only by your file, in the main branch:
on:
push:
branches: ['main']
paths: ['.github.yaml']
And use directly a gh repo edit -d '...' call, since the GitHub CLI I is preinstalled on all GitHub-hosted runners.
That way, each time you modify the .github.yaml file, you can regenerate the About message on your repository.
Related
I have been learning how to use Docusaurus to make markdown documentation websites recently.
My exact questions are:
How do I have to name the repository
What do I have to change in this config: https://i.stack.imgur.com/4WAhY.png
What branch do I need for what?
My goal is to create a site at ruixey.github.io, not at ruixey.github.io/REPO_NAME/
Thanks in advance for any help
Docusaurus side
Everything I can see looks correct according to the documentation Docusaurus provides:
Deploying to GitHub Pages | Docusaurus.
It states the following about which branch is used:
GitHub Pages picks up files from the default branch (master/main) or the gh-pages branch ...
and for deploying to the GH Page:
We provide a docusaurus deploy command
GitHub Pages side
Regarding your repository name, I recommend you to read the documentation that GitHub provides on Pages, which goes over the naming conventions when setting up a self-titled GitHub Pages deployment: Creating a GitHub Pages site
These docs say the following about choosing a repository name:
If you're creating a user site, your repository must be named <user>.github.io ...
If your user name contains uppercase letters, you must lowercase
the letters.
Source: Creating a repository for your site
Have you tried to deploy with your current configuration file? I don't see a reason why it should fail.
What do I have to change in this config
Assuming your repo URI is something like: git#github.com:Ruixey/roblox.git
organizationName: 'Ruixey', // Usually your GitHub org/user name.
projectName: 'roblox', // Usually your repo name.
// git#github.com:Ruixey/roblox.git <-- your ssh URI
// ^ ^
// organizationName projectName
What branch do I need for what?
main for your source, when you deploy, docusaurus will push to gh-pages branch, if the branch does not exist, this creates it.
$ USE_SSH=true yarn deploy
Having initialised a local repo and made an initial commit, VS code prompts me to 'Publish Branch' on GitHub.
I don't want to use GitHub as I am happy using a local repo in this case. Is this possible? I can't find an option to ignore the 'Publish Branch' prompt.
Before initializing a repository:
After initializing a repository:
After committing:
It's not really forcing you or prompting you to publish your repo to Github.
It's more of an option, a hint, or a recommendation, since when someone uses Git, they typically would want to push/publish their local copy of the repo to some remote copy of the same repo (ex. for sharing with other members of your team, etc.). But it's perfectly fine with Git and with Visual Studio Code's Source Control functions if all you want is to maintain it all locally. It shouldn't be blocking you from doing further local commits.
So
I don't want use GitHub do as I am happy using a local repo in this case - is this possible?
YES.
I can't find an option to ignore the 'Publish Branch' prompt.
If you don't want to see that button, you can hide it with the setting Git: Show Unpublished Commits introduced in VS Code 1.61 September 2021
By default, the Git extension will add a Sync Changes button as shown above, if there are unpushed commits, or a Publish Changes button if the branch hasn't yet been published. Additionally, users can customize this behavior by configuring the git.showUnpublishedCommitsButton setting, which defaults to whenEmpty so that the button will only be shown if there are unpushed commits and there are no other changes in the view.
"git.showUnpublishedCommitsButton": "never"
Just thought it looked a little odd as it differed from (albeit old) docs showing nothing, seemed intrusive, and was different to what I'm used to.
It's probably part of the continuous updates that further integrated Github with VS Code's UI (since both are now owned by Microsoft). The section on Initializing a Repository doesn't mention that it's required to publish to Github or to any other provider.
And to be clear, you can use pretty much any remote repo server/provider. It doesn't have to be Github. (Although the built-in UI is specifically tailored to use Github.)
I use a combination of GitHub Actions and GitHub Pages to generate and host a number of "semi-static" sites. That is sites that are updated regularly during the day using scheduled GitHub Actions. Here's one example.
The repos contain the HTML pages which make up the site, but those pages are all generated by GitHub Actions. There's no point in updating those files in a pull request as the changes will be overwritten the next time the site is regenerated.
I mention this in the README for the repos, but I still get PRs from people that change the output files, rather than the templates that are used to build the files.
To make my life that little easier, I'm wondering if there's a way to mark these files so that any PR that changes these files is automatically rejected with a polite comment explaining the problem. Alternatively, is there a way to mark these files so that GitHub knows they shouldn't be included in PRs?
It's an interesting idea so I tried and it worked!
I had to use pull_request_target as the event for forked repositories. More information can be found at https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/.
I've picked opened and reopened for the activity types, however please find more from here if you need it: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#pull_request
For now, this github action is triggered when the file untouchable_file is included as a change in a pull request, but if you need more complex path filter matching, see here: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
name: Test workflow
on:
pull_request_target:
types: [opened, reopened]
paths:
- 'untouchable_file'
jobs:
test:
runs-on: "ubuntu-latest"
steps:
- uses: superbrothers/close-pull-request#v3
with:
comment: "hi. please do not touch 'untouchable_file'."
I'm writing a PHP script that lets users enter a GitHub owner & repo name, and then it downloads a zip file from that repo.
GitHub allows linking directly to the download of the latest release for a repo: /owner/name/releases/latest/download/name.zip (see https://docs.github.com/en/free-pro-team#latest/github/administering-a-repository/linking-to-releases). So if a repo has a release, that works fine.
However, for repos without a release, I want to download from the default branch instead. GitHub provides a link for this (green 'Code' button > 'Download ZIP'), but that URL includes the branch name: /owner/name/archive/[BRANCH].zip.
Is there a way to link directly to the download for the latest branch without knowing what the branch might be called? For example, something like this hypothetical URL: /owner/name/archive/latest.zip
You would need to read the default branch of the repository first through GitHub API (See Get Repository)
Once you have the default branch, you can use it to complete your download URL
curl -L http://github.com/<user>/<repo>/archive/<branch>.zip --output <branch>.zip
Unless you need the default branch name for something, you can do this in one call.
https://api.github.com/repos/<user>/<repo>/zipball
For exmaple I have a public repository datetime_tag_helper with a .travis.yml file. I visit https://travis-ci.org/swordray/datetime_tag_helper , sign in and turn on building option. The page shows There are no builds for this repository. and blank Build History / Pull Requests / Branch Summary.
I think your GitHub repository isn't building because your.travis.yml is invalid. It looks like you want to build with Ruby version 2, in which case your .travis.yml should look like this:
language: ruby
rvm:
- 2.1.0
You can read up more about ruby on travis-ci here.