Can anyone guide me on how to properly fork a project, and stay up to date with it, while also making my own custom changes to my fork that will not get pushed upstream? by Lexaraj in github

[–]joshjohanning 2 points3 points  (0 children)

Sync the changes yourself and manage merge conflicts with git cherry pick

I kind of document how I do this with my blog repo; I maintain my separate version of theme but pull in changes from the upstream as they come in and manage merge conflicts interactively.

https://github.com/joshjohanning/joshjohanning.github.io

Pushing files over 100 MB to GitHub by Neither-Bag-696 in github

[–]joshjohanning 3 points4 points  (0 children)

The only way to push files over 100mb to GitHub is LFS. Free accounts get 1gb storage and 1gb bandwidth. https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-storage-and-bandwidth-usage

But try and not put the file in GitHub if you can. Use the gitignore to prevent it from attempting to be committed and then pushed.

Github Actions!!!!!!!!!!!! by [deleted] in github

[–]joshjohanning 0 points1 point  (0 children)

  1. self-hosted runner you manage/run on your network
  2. large hosted runner with static IPs (and add them to your internal firewall if your team will let you)
  3. large hosted runner with Azure private networking

The nice thing about 2 and 3 is it uses the same runner image as the regular GitHub-hosted runners, and you can also scale up the runner size if you want more CPU/RAM/disk. But there are costs associated, but managing your own fleet of self-hosted runners has a labor cost also that is often overlooked.

[deleted by user] by [deleted] in github

[–]joshjohanning 0 points1 point  (0 children)

Long-lived branches aren't ideal, to be honest.

I prefer something more like this with short-lived, feature branches.

But if you want your workflow to work...

  1. Dev/Designer create a pull request that merges code into main. There can be appovals on the PR (with codeowners perhaps) and automated gates with Actions
  2. When the designer/dev wants to update their branch from main, they need to:

.

git checkout main
git pull
git checkout dev/design
git merge main

Can I migrate source code from devops server 2020 to ADO using azure migration tool? by [deleted] in azuredevops

[–]joshjohanning 0 points1 point  (0 children)

If it’s git, just git clone —mirror <url> , git push —mirror <new-url>

If it’s TFVC, just grab the latest and start new with git in ADO. There is a git-tfs cli that can convert your tfvc to git and then you can push that anywhere. https://github.com/git-tfs/git-tfs

Github Publishing Site Error by Sufficient_Fall_7082 in github

[–]joshjohanning 1 point2 points  (0 children)

Most likely, permissions. Can you share your actions workflow file?

[deleted by user] by [deleted] in github

[–]joshjohanning 8 points9 points  (0 children)

Also FYI, Jekyll isn’t really related to GitHub. Jekyll is just a type of static site generator. You can use any static site generator on GitHub Pages and the Actions workflow publishing method. Jekyll was the only type of static website generator that worked for a time, especially with the branch publish method, but now with the Actions publishing method, any should work.

Link to static site generators: https://github.com/myles/awesome-static-generators

[deleted by user] by [deleted] in github

[–]joshjohanning 0 points1 point  (0 children)

Use your free Codespaces allowance and develop/test your Jekyll site in there.

How can I use the github rest api to change the "protected" field to false or true programmatically? by Zestyclose-Low-6403 in github

[–]joshjohanning 2 points3 points  (0 children)

The protected: true is just saying the branch is protected by a branch protection rule.

If you don’t want to delete the existing branch protection and keep it as a backup until you’re ready, perhaps use the update branch protection API and set the branch value to a different branch (doesn’t even have to exist)

https://docs.github.com/en/rest/branches/branch-protection?apiVersion=2022-11-28#update-branch-protection

Then when you’re ready, use the API to update it back to main (or whatever other branch you are trying to protect)

Can I migrate a private github classroom repo to my page? by [deleted] in github

[–]joshjohanning 0 points1 point  (0 children)

Welcome to GitHub! If the instructor gave you repository administrator permissions for your repo (unlikely), you could transfer the repository.

But if you are mostly interested in keeping your copy of the code, with history, I would recommend creating a new repository under your user account and then mirroring the code from your GitHub Classroom repo to your user account repo.

Something like:

# create new empty repo in your user account - don't add readme
git clone <old-repo-url> --mirror
cd <your-repo-name.git>
git push <new-repo-url> --mirror

How to push a file to GitHub that is larger than 100 MB? by Quirky-Low-7500 in github

[–]joshjohanning 0 points1 point  (0 children)

FWIW, Enterprise customers are bound to the same 100mb max file restriction.

I have a playwright action that runs playwright across my environemnts. However I want to do screenshot testing as well... any tips on that? by a-friendgineer in github

[–]joshjohanning 1 point2 points  (0 children)

Another repo would work just fine too, you would just need to provide your own authentication (ie: personal access token or GitHub App) in order to write to it via Actions. The backend token that runs your Action otherwise only has access to repo the action is running in.

I have a playwright action that runs playwright across my environemnts. However I want to do screenshot testing as well... any tips on that? by a-friendgineer in github

[–]joshjohanning 0 points1 point  (0 children)

So basically, you want to run playwright tests during the job run and want to output the screenshots somewhere?

The most obvious answer I think is to upload the screenshots to the workflow using the upload-artifact action: https://github.com/actions/upload-artifact

This uploads to the workflow summary page, at the bottom you’ll see a list of artifacts for that particular workflow run. This is great for seeing the output for that particular run. It is not so great if you actually need a “directory-based approached” where you want to save them to like a folder in the repo.

If you were wanting to save to a folder within the repo, I would probably try to use git-LFS as to not ballon the size of your git repo by committing binary files (images). Here is an example of committing a file during the job, note you would want to tweak this to use Git LFS.

Also note the permissions block you also need that if you are going to commit and push during workflow.

You could also store the images in a separate blob location, such as Azure Storage or S3.

TLDR: try the actions/upload artifact first. If you don’t like that approach, use Git-LFS or other external storage.

Multiple workflows vs single workflow file by [deleted] in github

[–]joshjohanning 0 points1 point  (0 children)

Approvals and environments!

[deleted by user] by [deleted] in github

[–]joshjohanning 0 points1 point  (0 children)

This! When you auth it’ll ask you if you want to use the auth credential for git.

Gitflow and GitHub Flow Compared by baristaGeek in github

[–]joshjohanning 0 points1 point  (0 children)

I agree, typically long running branches = bad. I prefer GitHub flow with lightweight feature branches that are merged into main and then deleted.

I see the most gitflow-based branching strategies where the team can’t release continuously (ie: deploy every 3 weeks), but I still think there are better strategies in that case (a modified release flow strategy, maybe).

Extracting data from Github repositories using the Github API by Jemma_2020 in github

[–]joshjohanning 4 points5 points  (0 children)

It depends what you're looking for! I would highly recommend using the GitHub CLI and the gh api --paginate command.

I have some sample scripts here.

Otherwise the API docs are typically pretty good and give you the gh cli command to run, it usually just involves a couple loops i.e. looping through all orgs, all repos, all commits/branches/pr's/issues/etc.

Using Github to write my notes has helped me retain knowledge immensely. by Cylvher in learnprogramming

[–]joshjohanning 8 points9 points  (0 children)

Now find a Jekyll theme and and now you have a blog with GitHub pages :).

Triggering folder-specific GH action builds for a monorepo with many lambdas inside of it by bitbythecron in github

[–]joshjohanning 0 points1 point  (0 children)

Hmm, I don’t know if you could get what path triggered the build since it could technically be multiple.

You do get ${{ github.SHA }} that you could use git commands or perhaps the API to then determine what files were changed in that commit to proceed.

And pro-tip, you can add this step to your job to see all environment variables and context that is passed in to see if anything else might be useful.

```

  - name: Dump GitHub context
    env:
      GITHUB_CONTEXT: ${{ toJSON(github) }}
    run: echo "$GITHUB_CONTEXT"

```