Skip to content

Instantly share code, notes, and snippets.

View guibranco's full-sized avatar
🎯
Focusing

Guilherme Branco Stracini guibranco

🎯
Focusing
View GitHub Profile
@guibranco
guibranco / build-bump-version.yml
Last active September 17, 2023 20:25
A GitHub action to build (debug) .NET framework project with some comments/reports on the Pull Request
name: Build & Bump Version
on:
push:
branches:
- '*'
- '*/*'
- '**'
- '!main'
paths-ignore:
@guibranco
guibranco / generateHTMLfromJSON.js
Last active December 15, 2023 15:42
Generate HTML from repositories list from API response
const jsonData = pm.response.json();
const divPattern = "<div style=\"margin-top: 10px;\">";
const imageUrl = (item) => `https://github-readme-stats-guibranco.vercel.app/api/pin/?username=${item.organization.login}&amp;repo=${item.name}&amp;theme=dark&amp;bg_color=222222&amp;show_owner=true&amp;show_forks=false&amp;show_issues=true`;
const link = (item) => `<a href="${item.url}" target="_blank">${image(item)}</a>`;
const image = (item) => `<img style="min-height: 100px; padding-right: 10px;" src="${imageUrl(item)}" alt="${item.full_name}" />`;
var html = divPattern;
for(let i = 0; i < jsonData.length; i++){
html += link(jsonData[i]);
@guibranco
guibranco / clone.ps1
Last active August 2, 2023 16:36
Clone all repositories from an organization in Azure DevOps
$organization = "AZURE_DEVOPS_ORGANIZATION"
$personalAccessToken = "AZURE_DEVOPS_PAT"
$base64AuthInfo = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($personalAccessToken)"))
$headers = @{Authorization=("Basic {0}" -f $base64AuthInfo)}
Write-Host "Cloning all repositories from organization: " $organization
$projectsUrl = "https://dev.azure.com/" + [uri]::EscapeDataString($organization) + "/_apis/projects?api-version=7.0"
$result = Invoke-RestMethod -Uri $projectsUrl -Method Get -Headers $headers
@guibranco
guibranco / build-deploy.yml
Last active December 15, 2023 15:39
Sample CI GitHub Action file for .NET Framework (MSBuild)
name: CI
on:
push:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
@guibranco
guibranco / build.yml
Last active December 15, 2023 15:40
Sample build & test GitHub Action file for .NET Framework (MSBuild)
name: Build
on:
push:
branches:
- '*'
- '*/*'
- '**'
- '!main'
paths-ignore:
@guibranco
guibranco / build-deploy.yml
Last active September 24, 2024 04:00
Sample CI GitHub Action file for .NET 8
name: CI
on:
push:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
@guibranco
guibranco / build.yml
Last active October 25, 2024 18:32
Sample build & test GitHub Action file for .NET 8
name: Build
on:
push:
branches:
- '*'
- '*/*'
- '**'
- '!main'
workflow_dispatch:
@guibranco
guibranco / dependabot.yml
Last active September 17, 2023 06:06
Sample dependabot.yml file to update Docker, GitHub-actions, NPM and Nuget outdated versions. Assign, request review and labeling the PR
version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 50
assignees:
- "guibranco"
@guibranco
guibranco / cloneRepositories.bash
Created February 21, 2023 12:57
Clone all repositories of an organization
#!/bin/bash
ORG_NAME="<<ORG>>"
ACCESS_TOKEN="<<GH_PAT>>"
TOTAL_PAGES=10;
eval `ssh-agent -s`
ssh-add ~/.ssh/*_rsa
for((PAGE=1;PAGE<=TOTAL_PAGES;PAGE++)); do
@guibranco
guibranco / createIssueViaPostman.js
Created January 29, 2023 16:57
Create an issue on each user/org repository that is not a fork and has issues enabled
//Request the user/org repositories, and add this script to tests tab of the request
//Repositories of a specific user: https://api.github.com/users/{{username}}/repos
//Repositories of a specific org: https://api.github.com/orgs/{{org}}/repos
const ghToken = pm.globals.get("GH_PAT");
const authorizationHeader = `Authorization: Bearer ${ghToken}`;
const issueTitle = "Issue title";
const issueBody = "Issue body";