diff --git a/.github/update-ghc.py b/.github/update-ghc.py index af5a4b3bf0..d38a2f2aea 100644 --- a/.github/update-ghc.py +++ b/.github/update-ghc.py @@ -102,6 +102,10 @@ def main(): with open('haskell/private/ghc_bindist_generated.bzl', 'r+') as generated: run(['buildifier'], check=True, input=bzl, stdout=generated) generated.truncate() + + if 'GITHUB_OUTPUT' in os.environ: + with open(os.environ["GITHUB_OUTPUT"], 'a') as output: + print(f"latest={ latest_release }", file=output) else: print("no tags found for prefix", prefix, file=sys.stderr) diff --git a/.github/workflows/update-ghc.yaml b/.github/workflows/update-ghc.yaml index 3754501ce8..bcf8f8f8c4 100644 --- a/.github/workflows/update-ghc.yaml +++ b/.github/workflows/update-ghc.yaml @@ -22,6 +22,16 @@ jobs: with: nix_path: nixpkgs=nixpkgs/default.nix - name: Fetch updates + id: ghc_update run: nix shell 'nixpkgs#bazel-buildtools' 'nixpkgs#python3' --command python .github/update-ghc.py ${{ matrix.ghc }} - - run: git diff + - name: Create Pull Request + if: steps.ghc_update.outputs.latest != '' + uses: peter-evans/create-pull-request@v5 + with: + commit-message: "[automation] Add GHC version " + title: "[update] GHC ${{ steps.ghc_update.latest }}" + branch: "automation/update-ghc-${{ matrix.ghc }}" + base: master + # TODO: needs a token so that workflows for the PR get triggered + #token: "${{ secrets.PR_TOKEN }}"