This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Configuration | |
#GITHUB_TOKEN="YOUR_PAT_TOKEN" # Personal access token with appropriate permissions | |
#ENTERPRISE="YOUR_ENTERPRISE" # Your enterprise slug/name | |
API_VERSION="2022-11-28" # GitHub API version | |
TEAMS_FILE="teams.txt" # File containing team to cost center mapping in the following format: team_slug,cost_center_id | |
# Check if teams file exists | |
if [ ! -f "$TEAMS_FILE" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query | |
{ | |
organization(login: "octodemo") { | |
teams(first: 100, after: null) { | |
nodes { | |
name | |
repositories { | |
nodes { | |
name | |
viewerPermission |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Pre-Merge Checks" | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ dev ] | |
# We only trigger long running tests on demand from another workflow | |
workflow_call: | |
inputs: | |
label_trigger: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
organization(login: "OrgName") { | |
repositories(first: 100, after: null) { | |
nodes { | |
id | |
nameWithOwner | |
description | |
url | |
collaborators(first: 20, after: null) { | |
edges { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
admin@malantin-009c14c14d9d1b660-ghe-test-org:~$ ghe-console -y < ghas.rb | |
Loading production environment | |
Loading config/console.rb | |
Switch to inspect mode. | |
<ctiveRecord::Base.connected_to(role: :reading) do | |
GitHub[production] (main):002:1* puts "Version 1.2.2" | |
GitHub[production] (main):003:1> emails = Set.new | |
< start_time = 90.days.ago.beginning_of_day | |
<tory.where(active: true).find_in_batches do |batch| | |
< Configurable.try(:preload_configuration, batch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Base.connected_to(role: :reading) do | |
puts "Version 1.2.2" | |
emails = Set.new | |
start_time = 90.days.ago.beginning_of_day | |
Repository.where(active: true).find_in_batches do |batch| | |
Configurable.try(:preload_configuration, batch) | |
batch.each do |repo| | |
Push | |
.where(repository: repo) | |
.where("created_at >= ?", start_time) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Remove old artifacts | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
age: | |
description: 'Age in days' | |
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conntect to Azure AD | |
Connect-AzureAD | |
# Get the Enterprise Application for GitHub Enterprise with EMU | |
$githubEMUenterpriseApp = Get-AzureADServicePrincipal -Filter "Displayname eq 'GitHub Enterprise Managed User'" | |
# Get all groups you want to assign, based on their name | |
$groups = Get-AzureADGroup -all $true | Where-Object {$_.DisplayName -like "Dev*"} | Select displayname,objectid | |
# Loop through all groups and assign them to your Enterprise Application Role | |
# Approles[1] Billing Manager | |
# Approles[2] User | |
# Approles[3] Enterprise Owner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git remote add github https://github.com/{username}/example.git | |
git remote add ownserver https://ownserver/{username}/example.git | |
git remote set-url --add --push origin https://github.com/{username}/example.git | |
git remote set-url --add --push origin https://ownserver/{username}/example.git |