Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Reference: https://stackoverflow.com/questions/12850030/git-getting-all-previous-version-of-a-specific-file-folder
#
# This is a shell script to find all commits where a file was touched inside a repository, and export copies of the file at
# the time of those commits to a /tmp directory. The files are organized in reverse-chronological order (most recent is #1)
# and include the time stamp and commit hash for reference. The full file is exported for each time it is changed/committed.
#
# With the full history of the file at every change, we can compare any arbitrary point in the file's history with
# another. Specifically, we can look at the state of the API as represented by the OpenAPI file, and compare that to
@LouManglass
LouManglass / gist:52a722afce4b6a6e532505a0f53712d9
Created April 21, 2021 18:43
specification.json - Issue 672
[
{"BatchCommitStarted":{"batchId":"6b733872-1f7d-45d0-a071-e1d27b9e3e09","commitMessage":"","parentId":null,"eventContext":{"clientId":"anonymous","clientSessionId":"ed9020fd-fc4e-4918-a093-ff89ec0b23db","clientCommandBatchId":"6b733872-1f7d-45d0-a071-e1d27b9e3e09","createdAt":"2021-04-21T03:32:08.186Z"}}}
,{"PathComponentAdded":{"pathId":"path_lWRYHPFNLM","parentPathId":"root","name":"users","eventContext":{"clientId":"anonymous","clientSessionId":"ed9020fd-fc4e-4918-a093-ff89ec0b23db","clientCommandBatchId":"6b733872-1f7d-45d0-a071-e1d27b9e3e09","createdAt":"2021-04-21T03:32:08.189Z"}}}
,{"PathComponentAdded":{"pathId":"path_t81QtEcaa7","parentPathId":"path_lWRYHPFNLM","name":"@me","eventContext":{"clientId":"anonymous","clientSessionId":"ed9020fd-fc4e-4918-a093-ff89ec0b23db","clientCommandBatchId":"6b733872-1f7d-45d0-a071-e1d27b9e3e09","createdAt":"2021-04-21T03:32:08.190Z"}}}
,{"PathComponentAdded":{"pathId":"path_6bueRcdryb","parentPathId":"root","name":"gateway","eventContext":{"clientId":"anonymous","
@LouManglass
LouManglass / .gitlab-ci.yml
Created March 1, 2021 15:36
Sample Gitlab CI job configuration to run tests on merge requests
default:
image: node:15
run-tests:
script:
- npm install @useoptic/cli # or add as a development dependency in your package manager
- npx api run run-diff-tests --exit-on-diff
only:
- merge_requests
pr:
main
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '15.x'
@LouManglass
LouManglass / main.yml
Created March 1, 2021 14:55
Checks specification by running tests with --exit-on-diff flag
name: Optic CI
on:
pull_request:
workflow_dispatch:
jobs:
check-spec:
runs-on: ubuntu-latest