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

add workflow for updateVendorHash of flake #789

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/flake_vendorhash.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "Flake vendorHash Updater"
on:
push:
branches:
- main
paths:
- 'go.mod'
- 'go.sum'
workflow_dispatch:
workflow_call:

jobs:
updateVendorHash:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.OCMBOT_APP_ID }}
private_key: ${{ secrets.OCMBOT_PRIV_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}
- name: Setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<41898282+github-actions[bot]@users.noreply.github.com>"
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Update ocm vendor hash
run: nix run .#nixpkgs.nix-update -- --flake --version=skip ocm
- name: Check diff
id: check-diff
run: |
diff=$(git diff)
if [[ -z "$diff" ]]; then
echo "Everything is tidy."
exit 0
fi

cat << EOF >> "${GITHUB_STEP_SUMMARY}"
\`\`\`diff
${diff}
\`\`\`
EOF
echo "push='true'" >> $GITHUB_ENV
- name: Push changes
if: github.event.pull_request.head.repo.fork == false && env.push == 'true'
run: |
diff=$(git diff)
if [[ ! -z "$diff" ]]; then
git config --global user.name "ocm-vendorhash"
git config --global user.email "[email protected]"
git commit -am "flake: update ocm vendorHash"
git push
fi
5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,10 @@
program = self.packages.${system}.${pname} + "/bin/ecrplugin";
};
});

legacyPackages = forAllSystems (system: rec {
nixpkgs = nixpkgsFor.${system};
});

};
}
Loading