Skip to content

Instantly share code, notes, and snippets.

View jonico's full-sized avatar
🪐
@ home

Johannes Nicolai jonico

🪐
@ home
View GitHub Profile
@jonico
jonico / sync-github-actions.sh
Created June 21, 2021 15:14
Use actions-sync to sync actions/ org and some custom actions
#!/usr/bin/bash
cd
mkdir -p /tmp/actions
git clone https://github.com/github/platform-samples.git
sdk install groovy
cd platform-samples/api/groovy/
groovy ListReposInOrg.groovy -t $GH_PUBLIC actions > ~/repo-list
cd
wget https://github.com/actions/actions-sync/releases/download/v202009231612/gh_202009231612_linux_amd64.tar.gz
@jonico
jonico / delete-all-package-versions.sh
Last active May 5, 2021 00:26
Delete all package versions of a package of certain GitHub repository
#!/bin/bash
# Script that works to delete private packages stored on Github Packages
#
# Script is based on the work of Troy Fontaine (github.com/troyfontaine)
GITHUB_TOKEN=$GPR_PAT
REPO_OWNER=$1
REPO_NAME=$2
PACKAGE_NAME=$3
@jonico
jonico / dind-github-actions-k8s-example.yaml
Last active April 29, 2021 15:45
Example of a GitHub Action runner pod managed by summerwind/actions-runner-controller that was successfully tested with container and services keywords in action workflow files
apiVersion: v1
items:
- apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2021-04-29T15:09:09Z"
labels:
pod-template-hash: 65f67dcb66
runner-deployment-name: actions-runner-deployment-epona
runner-template-hash: 6788f4694c
@jonico
jonico / notify_on_pr_assignments.coffee
Last active March 18, 2021 23:58
Hubot script that will send a direct message to any person that gets assigned to a pull request.
# Description
# Hubot script that will send a direct message to any person that gets assigned to a pull request.
# This came out of a discussion where a customer received too many GitHub notifications and wanted something
# succinct for the pull request assignment event.
#
# Dependencies:
# This script was tested with the slack adapter.
# In order to make use of it, you would have to put into Hubot's script folder and setup a GitHub webhook that points to
# <hubot deployment url>/hubot-pr and is delivering at least the pull requests events of the repositories you are interested
#
@jonico
jonico / search-for-pattern-in-all-repos.sh
Last active March 3, 2021 22:43
Search through all reachable commits in all branches and tags in all repos on GitHub Enterprise Server for a pattern (run it on a backup system)
# Replace the string "Hyrule" with your search pattern - only run on backup system - will take a LOOOONG time to run through
ghe-console -y <<'ENDSCRIPT'
Repository.find_each do |repository|
if repository.active && !repository.empty? then
host,path = GitHub::Routing.lookup_route(repository.nwo)
puts "Processing repo #{repository.nwo} ..."
refs=`git --git-dir=#{path} rev-list --branches --tags | sort | uniq`
refs.each_line do |ref|
if system("git --git-dir=#{path} grep 'Hyrule' #{ref}")
puts "Found pattern in ref #{ref} in repo #{repository.nwo}: "
@jonico
jonico / docker-build-publish.yaml
Created August 19, 2019 07:22
Build docker image and push to GPR with GitHub Actions
name: Build and publish Jekyll Docker image for Octocat Generator
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: clean up, docker login && docker build && docker push
@jonico
jonico / deps-with-licenses.graphql
Last active October 2, 2020 21:07
Retrieve dependency graph including licenses
{
repository(owner: "rails", name: "rails") {
nameWithOwner
description
dependencyGraphManifests(withDependencies: true) {
nodes {
filename
dependenciesCount
exceedsMaxSize
parseable
@jonico
jonico / azure-pipelines.yml
Last active September 14, 2020 04:17
Build and push a docker image into GitHub Package registry and create a tag in GitHub using Azure Pipelines (AZP) yaml files (azure-pipelines.yaml)
resources:
- repo: self
trigger:
- master
steps:
- script: ./cleanup.sh
displayName: Clean Up
@jonico
jonico / evaluierungsfragen.md
Last active December 6, 2019 08:51
Evaluierungsfragen/kriterien bei der Auswahl einer Versionskontrollverwaltungs- / Social Coding-Plattform

Business Coding Platform Evaluierungskriterien / Fragen

  • Wie lange dauert es, einen neuen Entwickler in die Plattform einzuarbeiten? Welcher Trainingsaufwand ist erforderlich, bis der erste Commit in Produktion gehen kann?

  • Wie unterstützt die gewählte Plattform das Aufbauen eines unternehmensweiten Entwickler-Profils, aus dem die Entwicklungsaktivität, Popularität, Programmiersprachen und Tätigkeitsschwerpunkt (welche Repositories) eines Entwicklers oder Entwicklerteams hervorgeht?

  • Wie können Entwickler und Designer schnell und unproblematisch Quellcode-Snippets, Design-Überlegungen, Interview-Fragen und andere Markdown-Dokumente miteinander teilen? Besteht die Möglichkeit, diese Dokumente zu durchsuchen, insofern sie nicht geheim angelegt worden?

  • Wie können Nicht-Entwickler (Ingenieure, Fachabteilung, Projektleiter, Marketing, Legal), Änderungen an Design-Dokumenten und Dokumentation ohne Kommandozeilenwissen oder Desktop-Applikationen vorschlagen? Erlaubt die Web-Oberfläche das Hinzufügen, Lö

@jonico
jonico / .gitconfig
Created August 9, 2016 09:38
My .gitconfig
[alias]
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# View the current working tree status using the short format
s = status -s
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"