Skip to content

Commit

Permalink
will this work?
Browse files Browse the repository at this point in the history
  • Loading branch information
nsheaps committed Sep 1, 2023
1 parent d87dc42 commit cd37a41
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 124 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"**/vscode-extension/**",
"**/.git/**",
"**/.pnpm-lock.json",
".github/workflows/**",
".vscode",
"megalinter",
"package-lock.json",
Expand Down
34 changes: 18 additions & 16 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env: # Comment env block if you do not want to apply fixes

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
build:
Expand All @@ -34,44 +34,46 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances

# MegaLinter
- name: MegaLinter
id: ml
# You can override MegaLinter flavor used to have faster performances
# More info at https://megalinter.io/flavors/
uses: oxsecurity/megalinter@v7
uses: oxsecurity/megalinter/flavors/cupcake@v7
env:
# All available variables are described in documentation
# https://megalinter.io/configuration/
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} # Validates all source when push on main, else just the git diff with main. Set 'true' if you always want to lint all sources
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }} # Validates all source when push on main, else just the git diff with main. Set 'true' if you always want to lint all sources
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ADD YOUR CUSTOM ENV VARIABLES HERE TO OVERRIDE VALUES OF .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY

# Upload MegaLinter artifacts
- name: Archive production artifacts
if: ${{ success() }} || ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: MegaLinter reports
path: |
megalinter-reports
mega-linter.log
# Create pull request if applicable (for now works only on PR from same repository, not from forks)
- name: Create Pull Request with applied fixes
id: cpr
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "[MegaLinter] Apply linters automatic fixes"
title: "[MegaLinter] Apply linters automatic fixes"
labels: bot
- name: Create PR output
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
if: ${{
steps.ml.outputs.has_updated_sources == 1
&& (
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
)
&& env.APPLY_FIXES_MODE == 'pull_request'
&& (
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
)
&& !contains(github.event.head_commit.message, 'skip fix')
}}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/publish.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/tests.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
# See all available variables at https://megalinter.io/configuration/ and in linters documentation

APPLY_FIXES: all # all, none, or list of linter keys

# ENABLE: # If you use ENABLE variable, all other languages/formats/tooling-formats will be disabled by default
# ENABLE_LINTERS: # If you use ENABLE_LINTERS variable, all other linters will be disabled by default
DISABLE:
- COPYPASTE # Comment to enable checks of excessive copy-pastes
# - SPELL # Uncomment to disable checks of spelling mistakes
- SPELL # Uncomment to disable checks of spelling mistakes
SHOW_ELAPSED_TIME: true
FILEIO_REPORTER: false
FLAVOR_SUGGESTIONS: true # suggest smaller flavors if available
# DISABLE_ERRORS: true # Uncomment if you want MegaLinter to detect errors but not block CI to pass
47 changes: 19 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
# homebrew-devsetup
A template for your own homebrew tap. Fork this repo (or copy it) and add your own formula to set up new devices how you want.

Expand Down Expand Up @@ -37,6 +36,11 @@ devsetup set-tap nsheaps/devsetup
devsetup install devsetup-base
```

## Maintenance

### Linting

`npx mega-linter-runner --flavor cupcake`
## Getting Started With Your Own Tap

This tap is to serve as an example and template for new taps for your own personalized setup. The only thing it comes with a basic structure of a homebrew tap, some example formulas to demonstrate OS-agnostic installs of specific software, and a tool for keeping your own devsetup up to date for use in an organization. The real power of this comes in when you customize it.
Expand All @@ -57,12 +61,12 @@ Fork or copy this repo and add your own formula to set up new devices how you wa

Uses `$HOME/.config/devsetup/` for any needed configuration files.

| command | description |
| --------- | ------------------- |
| `devsetup set-tap <tap>` | sets the tap to use for installing software. This is the tap that will be used when running `devsetup install <formula>`. |
| `devsetup get-tap` | prints the current tap. eg `nsheaps/devsetup` |
| command | description |
|--------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `devsetup set-tap <tap>` | sets the tap to use for installing software. This is the tap that will be used when running `devsetup install <formula>`. |
| `devsetup get-tap` | prints the current tap. eg `nsheaps/devsetup` |
| `devsetup install <formula>`<br>`devsetup i <formula>` | installs a formula from this tap, an alias for `brew install $(devsetup get-tap)/<formula>`. This is to avoid trying to pin this tap ([deprecated](https://github.com/Homebrew/brew/pull/5925)) when installing your locked versions of software |
| `devsetup upgrade-all` | updates the local clone of this tap (`devsetup update`), then upgrades all software installed from it (list, filter by `$(devsetup get-tap)/.*, run `brew upgrade <formula..>`)|
| `devsetup upgrade-all` | updates the local clone of this tap (`devsetup update`), then upgrades all software installed from it (list, filter by `$(devsetup get-tap)/.*, run`brew upgrade <formula..>`)|
| `devsetup upgrade <formula>`<br>`devsetup u <formula>` | alias for `brew upgrade $(devsetup get-tap)/<formula>`, always upgrades `devsetup` even if from another tap. |
| `devsetup update` | Alias for `$(cd $(brew --repository $(devsetup get-tap)) && git pull)`. This is to avoid updating other taps. |
| `devsetup outdated` | Alias for `brew outdated $(devsetup get-tap)/.*` |
Expand Down Expand Up @@ -95,32 +99,19 @@ Passing `--force` will remove the configuration without warning.

If you want any of these configurations to happen automatically on `devsetup install`, add the formula as a depdendency to the `devsetup` formula.

| topic | description |
| --------- | ------------------- |
| `git` | sets up git with a global user and email. |
| `github-token` | sets up a GITHUB_TOKEN and adds it to your `~/.profile` |
| `github-ssh` | sets up github to prefer ssh via `git config --global url.ssh://[email protected]/.insteadOf https://github.com/`, and then runs `gh ssh-key add $(devsetup-configure-ssh --keyfile)`.<br><b>Note:</b> depends on `gh` and `nsheaps/devsetup/devsetup-configure-ssh` |
| `ssh` | sets up ssh with a key and config. Also provides a `--keyfile [keytype]` to return the location of the requested keyfile |
| `gpg` | sets up gpg with a key and config |
| `aws` | sets up aws with a profile and config |
| topic | description |
|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `git` | sets up git with a global user and email. |
| `github-token` | sets up a GITHUB_TOKEN and adds it to your `~/.profile` |
| `github-ssh` | sets up github to prefer ssh via `git config --global url.ssh://[email protected]/.insteadOf https://github.com/`, and then runs `gh ssh-key add $(devsetup-configure-ssh --keyfile)`.<br><b>Note:</b> depends on `gh` and `nsheaps/devsetup/devsetup-configure-ssh` |
| `ssh` | sets up ssh with a key and config. Also provides a `--keyfile [keytype]` to return the location of the requested keyfile |
| `gpg` | sets up gpg with a key and config |
| `aws` | sets up aws with a profile and config |

## TODO

* [ ] Test `brew list` and see if it dumps list prefixed with installed tap (no tap is `homebrew/core`)
* [ ] Test creating an alias via [`livecheck`](https://docs.brew.sh/Brew-Livecheck#referenced-formulacask) and see if it works
* It should, since normally it's looking at the local tap, `livecheck` should check upstream if there are updates.
* It should, since normally it's looking at the local tap, `livecheck` should check upstream if there are updates.
* [ ] Figure out a way to pass flags for devsetup-configure scripts
* [ ] Figure out a way to reference dependencies via env var for referencing the tap rather than fully qualified
=======
# Nsheaps Devsetup

## How do I install these formulae?

`brew install nsheaps/devsetup/<formula>`

Or `brew tap nsheaps/devsetup` and then `brew install <formula>`.

## Documentation

`brew help`, `man brew` or check [Homebrew's documentation](https://docs.brew.sh).
>>>>>>> 96f8bab (Create nsheaps/devsetup tap)

0 comments on commit cd37a41

Please sign in to comment.