freckle / stack-bump-lts-action

GitHub Action to update a stack-based Haskell project to latest resolver
MIT License
1 stars 0 forks source link

Use input to support custom snapshot repo #3

Closed stackptr closed 1 year ago

stackptr commented 1 year ago

Supports a resolver that points to a custom snapshot repo via a github-repo input to the action. If this is set, the resolver values are determined as paths to a https://raw.githubusercontent.com/$repo/$branch/$version which is how snapshots are setup in freckle/stackage-snapshots, which follows the structure of commercialhaskell/stackage-snapshots.

stackptr commented 1 year ago

I've updated branch protection settings but the matrix inputs make things a little wonky:

Screenshot 2023-07-13 at 10 55 47 AM
pbrisbin commented 1 year ago

So this is what happens when you only use include to define the matrix. If you instead do something like this:

    strategy:
      matrix:
        label:
          - lts
          - custom
        include:
          - label: lts
            working-directory: test/lts-example
            expected-current: lts-20.20
          - label: custom
            working-directory: test/custom-repo-example
            expected-current: https://raw.githubusercontent.com/freckle/stackage-snapshots/main/lts/20/20.yaml
            github-repo: freckle/stackage-snapshots
      fail-fast: false

You get the two Jobs/statuses test (custom) and test (lts), which are nicer as required statuses.

You could also pick either of working-directory or expected-current as the main key, e.g:

    strategy:
      matrix:
        working-directory:
          - test/lts-example
          - test/custom-repo-example
        include:
          - working-directory: test/lts-example
            expected-current: lts-20.20
          - working-directory: test/custom-repo-example
            expected-current: https://raw.githubusercontent.com/freckle/stackage-snapshots/main/lts/20/20.yaml
            github-repo: freckle/stackage-snapshots
      fail-fast: false

but I introduced the extra label because I didn't think either of those values were sufficiently "nice".

stackptr commented 1 year ago

I like that approach!