fix: workflow no git user config #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI topology updater | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb | |
with: | |
persist-credentials: false | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@dea7810afd9d4c98556c8ec68cf361bd5b648eaa | |
- name: Setup Nix Cache | |
uses: DeterminateSystems/magic-nix-cache-action@13dabe8ccc07ba82ad7ccfa52035616223194012 | |
- name: Build Topology | |
run: nix build .#topology.x86_64-linux.config.output --extra-experimental-features pipe-operators | |
- name: Move Topology | |
run: sudo cp -r result/* assets/topology/ | |
- name: Setup git user | |
run: | | |
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)" | |
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)" | |
- name: Compare and replace | |
env: | |
PR_URL: ${{github.event.pull_request.html_url}} | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: | | |
if [[ -n "$(git status assets --porcelain)" ]]; then | |
git commit -m "chore: Topology Update" | |
gh pr create --title "chore: Topology Update" --body "Automated PR to update the Topology in the README file." | |
gh pr merge --auto --rebase "$PR_URL" | |
fi |