Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/installer: Cleanups (2/n) #833

Merged
merged 15 commits into from Aug 22, 2022

Conversation

justaugustus
Copy link
Member

@justaugustus justaugustus commented Aug 20, 2022

Continuation of #301.
Part of #52 and #765.

  • go.mod: Update to github.com/google/go-github/v46
  • install/github: Comment out GitHub client code
  • install/github: Use scorecard roundtripper for authentication
  • install/github: Restore commented-out code
  • Fix lint warnings
  • install: Skip workflow creation if file already exists
  • install: Don't block PR creation if the workflow file does not exist
  • install/github: Reference pull request link in log message
  • install: Parameterize method inputs
  • install: Improve pull request description
  • Move repo installation tool to cmd/ directory
  • cmd/installer: Update installation instructions
  • install: Improve log messages
  • install: Restructure Run() function to reduce cognitive complexity
  • install/github: Add functions for generating GitHub API options

Signed-off-by: Stephen Augustus foo@auggie.dev

@justaugustus justaugustus added this to In progress in Scorecard via automation Aug 20, 2022
@codecov
Copy link

codecov bot commented Aug 20, 2022

Codecov Report

Merging #833 (a75835f) into main (2693af3) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #833   +/-   ##
=======================================
  Coverage   64.10%   64.10%           
=======================================
  Files           4        4           
  Lines         234      234           
=======================================
  Hits          150      150           
  Misses         72       72           
  Partials       12       12           
Impacted Files Coverage Δ
cmd/installer/main.go 0.00% <ø> (ø)
signing/signing.go 34.48% <ø> (ø)

Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
@justaugustus
Copy link
Member Author

Here's what an installer run looks like in de6c4cd:

GITHUB_TOKEN=$(cat ~/.github-token) go run cmd/installer/main.go --owner uwu-tools
2022/08/22 04:46:21 No repositories provided. Fetching all repositories under organization.
2022/08/22 04:46:21 getting repo metadata for go-ghcrawl
2022/08/22 04:46:21 checking for scorecard workflow file (.github/workflows/scorecards.yml)
2022/08/22 04:46:22 checking for scorecard workflow file (.github/workflows/scorecards-analysis.yml)
2022/08/22 04:46:22 could not find a scorecard workflow file: getting repo content: GET https://api.github.com/repos/uwu-tools/go-ghcrawl/contents/.github/workflows/scorecards-analysis.yml: 404 Not Found []
2022/08/22 04:46:24 successfully created PR #6 for repository go-ghcrawl: https://github.com/uwu-tools/go-ghcrawl/pull/6
2022/08/22 04:46:24 finished processing repository go-ghcrawl
2022/08/22 04:46:24 getting repo metadata for k-release
2022/08/22 04:46:24 checking for scorecard workflow file (.github/workflows/scorecards.yml)
2022/08/22 04:46:24 checking for scorecard workflow file (.github/workflows/scorecards-analysis.yml)
2022/08/22 04:46:24 skipping repo (k-release) since scorecard workflow already exists: .github/workflows/scorecards-analysis.yml
2022/08/22 04:46:24 finished processing repository k-release

And here's what an example pull request looks like: uwu-tools/go-ghcrawl#6

@justaugustus justaugustus changed the title [WIP] multi-repo-action: Cleanups (2/n) [WIP] cmd/installer: Cleanups (2/n) Aug 22, 2022
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
@justaugustus justaugustus enabled auto-merge (squash) August 22, 2022 10:35
@justaugustus justaugustus changed the title [WIP] cmd/installer: Cleanups (2/n) cmd/installer: Cleanups (2/n) Aug 22, 2022
@justaugustus justaugustus requested a review from a team August 22, 2022 10:36
@justaugustus
Copy link
Member Author

@ossf/scorecard-maintainers - These updates to the GitHub Action installation tool are ready for review!

In the next batch of updates, I'd like to combine the following GitHub clients:

We currently have the following comment in code:

// ParseFromURL is a function to get the repository information.
// It is decided to not use the golang GitHub library because of the
// dependency on the github.com/google/go-github/github library
// which will in turn require other dependencies.

...but as we've introduced the go-github library to support the installer tool, it makes sense to deduplicate common code paths.

As part of that deduplication, I'll be able to mock the GitHub client and write a few tests for previously uncovered code paths.

cmd/installer/README.md Show resolved Hide resolved
install/github/github.go Show resolved Hide resolved
Scorecard automation moved this from In progress to Reviewer approved Aug 22, 2022
@justaugustus justaugustus merged commit fe6daaf into ossf:main Aug 22, 2022
Scorecard automation moved this from Reviewer approved to Done Aug 22, 2022
bors bot added a commit to OpenPoolProject/stratum that referenced this pull request Nov 6, 2022
273: chore(deps): update ossf/scorecard-action action to v2 r=renovate[bot] a=renovate[bot]

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ossf/scorecard-action](https://togithub.com/ossf/scorecard-action) | action | major | `v1.1.1` -> `v2.0.6` |

---

### Release Notes

<details>
<summary>ossf/scorecard-action</summary>

### [`v2.0.6`](https://togithub.com/ossf/scorecard-action/releases/tag/v2.0.6)

[Compare Source](https://togithub.com/ossf/scorecard-action/compare/v2.0.5...v2.0.6)

#### What's Changed

-   Fix - Broken dockerfile by [`@&#8203;naveensrinivasan](https://togithub.com/naveensrinivasan)` in [ossf/scorecard-action#979

**Full Changelog**: ossf/scorecard-action@v2.0.5...v2.0.6

### [`v2.0.5`](https://togithub.com/ossf/scorecard-action/releases/tag/v2.0.5)

[Compare Source](https://togithub.com/ossf/scorecard-action/compare/v2.0.4...v2.0.5)

#### What's Changed

-   Remove trailing space from example by [`@&#8203;jamacku](https://togithub.com/jamacku)` in [ossf/scorecard-action#955
-   🌱 Bump actions/cache from 3.0.8 to 3.0.10 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#956
-   🌱 Bump github/codeql-action from 2.1.25 to 2.1.26 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#957
-   🌱 Bump step-security/harden-runner from 1.4.5 to 1.5.0 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#958
-   🌱 Bump debian from `5cf1d98` to `b46fc4e` by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#959
-   🌱 Bump github.com/sigstore/cosign from 1.12.1 to 1.13.0 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#962
-   🌱 Upgrade to go 1.19 by [`@&#8203;naveensrinivasan](https://togithub.com/naveensrinivasan)` in [ossf/scorecard-action#961
-   🌱 Bump github.com/spf13/cobra from 1.5.0 to 1.6.0 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#967
-   🌱 Bump golang from `c2a98a5` to `b850621` by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#966
-   🌱 Bump golang from `b850621` to `25de7b6` by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#968
-   New release for Scorecard v4.8.0 by [`@&#8203;naveensrinivasan](https://togithub.com/naveensrinivasan)` in [ossf/scorecard-action#969

#### New Contributors

-   [`@&#8203;jamacku](https://togithub.com/jamacku)` made their first contribution in [ossf/scorecard-action#955

**Full Changelog**: ossf/scorecard-action@v2.0.4...v2.0.5

### [`v2.0.4`](https://togithub.com/ossf/scorecard-action/releases/tag/v2.0.4)

[Compare Source](https://togithub.com/ossf/scorecard-action/compare/v2.0.3...v2.0.4)

Fixes [#&#8203;856](https://togithub.com/ossf/scorecard-action/issues/856)

#### What's Changed

-   🌱 Bump github.com/caarlos0/env/v6 from 6.10.0 to 6.10.1 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#934
-   feat: do not run signing on pull requests by [`@&#8203;laurentsimon](https://togithub.com/laurentsimon)` in [ossf/scorecard-action#935
-   🌱 Bump debian from 11.4-slim to 11.5-slim by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#936
-   🌱 Bump github.com/sigstore/cosign from 1.11.1 to 1.12.0 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#938
-   🌱 Bump github/codeql-action from 2.1.22 to 2.1.24 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#941
-   🐛 Restore behavior of ignoring scorecard runtime errors by [`@&#8203;spencerschrock](https://togithub.com/spencerschrock)` in [ossf/scorecard-action#948
-   🌱 Bump actions/dependency-review-action from 2.1.0 to 2.4.0 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#950
-   🌱 Bump github.com/sigstore/cosign from 1.12.0 to 1.12.1 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#947
-   🌱 Bump github/codeql-action from 2.1.24 to 2.1.25 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#949
-   🌱 Bump codecov/codecov-action from 3.1.0 to 3.1.1 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#942
-   Create v2.0.4 patch by [`@&#8203;spencerschrock](https://togithub.com/spencerschrock)` in [ossf/scorecard-action#952

#### New Contributors

-   [`@&#8203;spencerschrock](https://togithub.com/spencerschrock)` made their first contribution in [ossf/scorecard-action#948

**Full Changelog**: ossf/scorecard-action@v2.0.3...v2.0.4

### [`v2.0.3`](https://togithub.com/ossf/scorecard-action/releases/tag/v2.0.3)

[Compare Source](https://togithub.com/ossf/scorecard-action/compare/v2.0.2...v2.0.3)

Patch for fix in [#&#8203;898](https://togithub.com/ossf/scorecard-action/issues/898)

### [`v2.0.2`](https://togithub.com/ossf/scorecard-action/releases/tag/v2.0.2)

[Compare Source](https://togithub.com/ossf/scorecard-action/compare/v2.0.1...v2.0.2)

Fixes [ossf/scorecard-action#895

### [`v2.0.1`](https://togithub.com/ossf/scorecard-action/releases/tag/v2.0.1)

[Compare Source](https://togithub.com/ossf/scorecard-action/compare/v2.0.0...v2.0.1)

Fix for [#&#8203;856](https://togithub.com/ossf/scorecard-action/issues/856)

### [`v2.0.0`](https://togithub.com/ossf/scorecard-action/releases/tag/v2.0.0)

[Compare Source](https://togithub.com/ossf/scorecard-action/compare/v1.1.2...v2.0.0)

#### What's Changed

-   🌱 Prepare for a pre-release of the Golang action by [`@&#8203;azeemshaikh38](https://togithub.com/azeemshaikh38)` in [ossf/scorecard-action#750
-   🌱 Bump github/codeql-action from 2.1.12 to 2.1.16 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#751
-   🌱 Bump debian from 11.3-slim to 11.4-slim by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#749
-   🌱 Bump step-security/harden-runner from 1.4.3 to 1.4.4 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#646
-   🌱 Bump actions/setup-go from 3.2.0 to 3.2.1 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#748
-   🐛 Fix dependency conflicts in go.mod by [`@&#8203;azeemshaikh38](https://togithub.com/azeemshaikh38)` in [ossf/scorecard-action#771
-   🌱 Prepare for v2 beta1 release by [`@&#8203;azeemshaikh38](https://togithub.com/azeemshaikh38)` in [ossf/scorecard-action#766
-   multi-repo-action: Note that tool is a work-in-progress by [`@&#8203;naveensrinivasan](https://togithub.com/naveensrinivasan)` in [ossf/scorecard-action#776
-   🐛 Fix intermittent failures in CI-Tests by [`@&#8203;azeemshaikh38](https://togithub.com/azeemshaikh38)` in [ossf/scorecard-action#778
-   🌱 Bump sigs.k8s.io/release-utils from 0.7.2 to 0.7.3 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#775
-   🌱 Bump actions/cache from 3.0.4 to 3.0.5 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#769
-   📖 Update README about the restrictions for scorecard-action:v2 by [`@&#8203;azeemshaikh38](https://togithub.com/azeemshaikh38)` in [ossf/scorecard-action#779
-   🌱 Bump github/codeql-action from 2.1.16 to 2.1.17 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#783
-   📖 Update instructions for Scorecard badge to README by [`@&#8203;azeemshaikh38](https://togithub.com/azeemshaikh38)` in [ossf/scorecard-action#785
-   🌱 Bump debian from `f576b80` to `a811e62` by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#787
-   🌱 Bump github.com/ossf/scorecard/v4 from 4.4.0 to 4.5.0 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#786
-   🌱 Bump github/codeql-action from 2.1.17 to 2.1.18 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#788
-   🌱 Bump actions/cache from 3.0.5 to 3.0.6 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#789
-   🐛 Add request application/json request header by [`@&#8203;azeemshaikh38](https://togithub.com/azeemshaikh38)` in [ossf/scorecard-action#791
-   Create a new release v2.0.0-alpha.1 by [`@&#8203;azeemshaikh38](https://togithub.com/azeemshaikh38)` in [ossf/scorecard-action#803
-   🌱 Bump actions/cache from 3.0.6 to 3.0.7 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#807
-   Olivekl patch 1 by [`@&#8203;olivekl](https://togithub.com/olivekl)` in [ossf/scorecard-action#809
-   🌱 Fix cosign vulnerability by [`@&#8203;naveensrinivasan](https://togithub.com/naveensrinivasan)` in [ossf/scorecard-action#812
-   🌱 Allow for publish URL override by [`@&#8203;azeemshaikh38](https://togithub.com/azeemshaikh38)` in [ossf/scorecard-action#811
-   🌱 Bump github.com/ossf/scorecard/v4 from 4.5.0 to 4.6.0 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#820
-   🌱 Bump step-security/harden-runner from 1.4.4 to 1.4.5 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#808
-   cmd/installer: Cleanups (2/n) by [`@&#8203;justaugustus](https://togithub.com/justaugustus)` in [ossf/scorecard-action#833
-   Update comments to allow for renovatebot updates by [`@&#8203;laurentsimon](https://togithub.com/laurentsimon)` in [ossf/scorecard-action#834
-   🌱 Bump github.com/caarlos0/env/v6 from 6.9.3 to 6.10.0 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#839
-   🌱 Update actions/checkout requirement to [`2541b12`](https://togithub.com/ossf/scorecard-action/commit/2541b1294d2704b0964813337f33b291d3f8596b) by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#835
-   🌱 Bump github.com/sigstore/cosign from 1.11.0 to 1.11.1 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#842
-   🌱 Bump github/codeql-action from 2.1.18 to 2.1.21 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#844
-   🌱 Bump actions/setup-go from 3.2.1 to 3.3.0 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#843
-   🌱 Bump debian from `a811e62` to `68c1f6b` by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#840
-   Fix workflow path in automatic creation of PR  by [`@&#8203;RadoslavGatev](https://togithub.com/RadoslavGatev)` in [ossf/scorecard-action#845
-   🌱 Bump actions/dependency-review-action from [`310e0dd`](https://togithub.com/ossf/scorecard-action/commit/310e0dd64f63b1d00101ecd3225d605a74261fb7) to 2.1.0 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#838
-   🌱 Bump actions/cache from 3.0.7 to 3.0.8 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#836
-   📖 Add docs for API by [`@&#8203;azeemshaikh38](https://togithub.com/azeemshaikh38)` in [ossf/scorecard-action#849
-   🌱 Bump github/codeql-action from 2.1.21 to 2.1.22 by [`@&#8203;dependabot](https://togithub.com/dependabot)` in [ossf/scorecard-action#853
-   🌱 Included License by [`@&#8203;naveensrinivasan](https://togithub.com/naveensrinivasan)` in [ossf/scorecard-action#852
-   🌱 Release v2.0.0 by [`@&#8203;naveensrinivasan](https://togithub.com/naveensrinivasan)` in [ossf/scorecard-action#854

#### New Contributors

-   [`@&#8203;RadoslavGatev](https://togithub.com/RadoslavGatev)` made their first contribution in [ossf/scorecard-action#845

**Full Changelog**: ossf/scorecard-action@v1.1.2...v2.0.0

### [`v1.1.2`](https://togithub.com/ossf/scorecard-action/releases/tag/v1.1.2)

[Compare Source](https://togithub.com/ossf/scorecard-action/compare/v1.1.1...v1.1.2)

#### What's Changed

-   Fix for [ossf/scorecard-action#329

**Full Changelog**: ossf/scorecard-action@v1.1.1...v1.1.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/OpenPoolProject/stratum).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzQuMTkuMCJ9-->


Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants