@jaspermayone.com's dotfiles

Merge pull request #5 from jaspermayone/fix-update-workflow

authored by jaspermayone.com and committed by

GitHub a4a47f9b 9b126885

+36 -2
+36 -2
.github/workflows/update-packages.yml
··· 61 61 sed -i "s|hash = \"sha256-.*\";|hash = \"$NEW_HASH_SRI\";|" packages/wut.nix 62 62 63 63 # Try to build to get vendorHash 64 - if ! nix build .#nixosConfigurations.horace.pkgs.wut 2>&1 | tee build.log; then 64 + # Save build log but don't commit it 65 + if ! nix build .#nixosConfigurations.horace.pkgs.wut 2>&1 | tee /tmp/build.log; then 65 66 # Extract the correct vendorHash from the error message 66 - VENDOR_HASH=$(grep "got:" build.log | tail -1 | awk '{print $2}') 67 + VENDOR_HASH=$(grep "got:" /tmp/build.log | tail -1 | awk '{print $2}') 67 68 if [ -n "$VENDOR_HASH" ]; then 68 69 sed -i "s|vendorHash = \"sha256-.*\";|vendorHash = \"$VENDOR_HASH\";|" packages/wut.nix 69 70 fi 70 71 fi 72 + 73 + # Save build log for later comment 74 + echo "BUILD_LOG<<EOF" >> $GITHUB_ENV 75 + cat /tmp/build.log >> $GITHUB_ENV 76 + echo "EOF" >> $GITHUB_ENV 71 77 72 78 - name: Create Pull Request 73 79 if: steps.check-release.outputs.update_needed == 'true' 80 + id: create-pr 74 81 uses: peter-evans/create-pull-request@v6 75 82 with: 76 83 token: ${{ secrets.GITHUB_TOKEN }} ··· 87 94 **Release Notes:** https://github.com/simonbs/wut/releases/tag/v${{ steps.check-release.outputs.new_version }} 88 95 branch: update-wut-v${{ steps.check-release.outputs.new_version }} 89 96 delete-branch: true 97 + 98 + - name: Add build log comment 99 + if: steps.check-release.outputs.update_needed == 'true' && steps.create-pr.outputs.pull-request-number 100 + uses: actions/github-script@v7 101 + env: 102 + BUILD_LOG: ${{ env.BUILD_LOG }} 103 + with: 104 + script: | 105 + const buildLog = process.env.BUILD_LOG; 106 + await github.rest.issues.createComment({ 107 + owner: context.repo.owner, 108 + repo: context.repo.repo, 109 + issue_number: ${{ steps.create-pr.outputs.pull-request-number }}, 110 + body: `<details>\n<summary>Build Log</summary>\n\n\`\`\`\n${buildLog}\n\`\`\`\n\n</details>` 111 + }); 112 + 113 + - name: Request review 114 + if: steps.check-release.outputs.update_needed == 'true' && steps.create-pr.outputs.pull-request-number 115 + uses: actions/github-script@v7 116 + with: 117 + script: | 118 + await github.rest.pulls.requestReviewers({ 119 + owner: context.repo.owner, 120 + repo: context.repo.repo, 121 + pull_number: ${{ steps.create-pr.outputs.pull-request-number }}, 122 + reviewers: ['jaspermayone'] 123 + });