Skip to content

Improve hc-scaffold cranelib filters #21

Improve hc-scaffold cranelib filters

Improve hc-scaffold cranelib filters #21

name: command-listener
on:
issue_comment:
types: ["created"]
jobs:
action_pr_comment:
name: Action PR comment
if: ${{ github.event.issue.pull_request }}
runs-on: ubuntu-latest
steps:
- name: Dispatch
id: dispatch
env:
USER: ${{ github.event.sender.login }}
ALLOWED_USERS: ${{ join(fromJson('["ThetaSinner", "jost-s", "maackle", "neonphog", "matthme", "c12i"]'), '\n') }}
COMMENT: ${{ github.event.comment.body }}
run: |
set -euo pipefail
COMMAND=""
if [[ "$COMMENT" == @hra* ]]; then
echo "Comment is a command"
COMMAND=$(echo "$COMMENT" | cut -b 6- | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
else
echo "Comment is not a command"
exit 0
fi
if echo "$ALLOWED_USERS" | grep -q "${USER}"; then
echo "User $USER is allowed to run commands"
else
echo "User $USER is not allowed to run commands"
exit 1
fi
echo "Setting command '$COMMAND'"
echo "action=${COMMAND}" >> "$GITHUB_OUTPUT"
outputs:
action: ${{ steps.dispatch.outputs.action }}
bump_holochain:
name: Bump Holochain
runs-on: ubuntu-latest
needs: [action_pr_comment]
if: ${{ startsWith(needs.action_pr_comment.outputs.action, 'bump holochain') }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
install_url: https://releases.nixos.org/nix/nix-2.24.4/install
extra_nix_config: |
accept-flake-config = true
- name: set up git config
run: |
./scripts/ci-git-config.sh
- name: Flake update
env:
PR_NUMBER: ${{ github.event.issue.number }}
GH_TOKEN: ${{ secrets.HRA_GITHUB_TOKEN }}
run: |
gh pr checkout $PR_NUMBER --repo holochain/holonix
./scripts/bump-holochain.sh
git add flake.nix flake.lock
git commit -m "Bump Holochain version"
git pull --rebase
git push
bump_hc_launch:
name: Bump hc-launch
runs-on: ubuntu-latest
needs: [action_pr_comment]
if: ${{ startsWith(needs.action_pr_comment.outputs.action, 'bump hc-launch') }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
install_url: https://releases.nixos.org/nix/nix-2.24.4/install
extra_nix_config: |
accept-flake-config = true
- name: set up git config
run: |
./scripts/ci-git-config.sh
- name: Flake update
env:
PR_NUMBER: ${{ github.event.issue.number }}
GH_TOKEN: ${{ secrets.HRA_GITHUB_TOKEN }}
run: |
gh pr checkout $PR_NUMBER --repo holochain/holonix
nix flake update hc-launch
git add flake.lock
git commit -m "Bump hc-launch version"
git pull --rebase
git push
bump_hc_scaffold:
name: Bump hc-scaffold
runs-on: ubuntu-latest
needs: [ action_pr_comment ]
if: ${{ startsWith(needs.action_pr_comment.outputs.action, 'bump hc-scaffold') }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
install_url: https://releases.nixos.org/nix/nix-2.24.4/install
extra_nix_config: |
accept-flake-config = true
- name: set up git config
run: |
./scripts/ci-git-config.sh
- name: Flake update
env:
PR_NUMBER: ${{ github.event.issue.number }}
GH_TOKEN: ${{ secrets.HRA_GITHUB_TOKEN }}
run: |
gh pr checkout $PR_NUMBER --repo holochain/holonix
nix flake update hc-scaffold
git add flake.lock
git commit -m "Bump hc-scaffold version"
git pull --rebase
git push