emacs-php / php-ts-mode

A Tree-sitter based major mode for editing PHP codes
GNU General Public License v3.0
20 stars 8 forks source link

add emacs snapshot update action #22

Closed piotrkwiecinski closed 1 year ago

piotrkwiecinski commented 1 year ago

This is a scheduled action. It triggers once a month. It updates flake lock and creates a PR if file content changed.

In addition it's possible to trigger the action manually.

resolves #21

piotrkwiecinski commented 1 year ago

@akirak would could you have a look and validate if we need to add anything else? You're more experienced with nix. Should we include:

extraPullNames: nix-community
akirak commented 1 year ago

Should we include: extraPullNames: nix-community

No. nix flake update only updates the inputs specified in the inputs section of flake.nix, so we won't build packages in this workflow. (flake-utils and systems are not defined in the flake, but they are included in the global registry of Nix.)

Even if we build packages, we only need Emacs executables, which is available on emacs-ci cache on Cachix, which is configured in the flake.nix of this repository. To enable the cache, you only need --accept-flake-config flag (or accept-flake-config = true in the config file as in test workflow):

nix develop .#emacs-release-snapshot --accept-flake-config
piotrkwiecinski commented 1 year ago

@akirak do we also need --accept-flake-config added to flake update action?

piotrkwiecinski commented 1 year ago

Note that peter-evans/create-pull-request doesn't trigger workflows by default. See https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs for information.

Thank you for highlighting it. @zonuexe which option do you prefer? I reckon we could go with https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#authenticating-with-github-app-generated-tokens or https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#push-using-ssh-deploy-keys but it's going to need some ground work done by you.

As we don't push to remote repository deployment ssh key should be enough.

akirak commented 1 year ago

do we also need --accept-flake-config added to flake update action?

No, we need it only for nix develop. I have already added it to the test workflow (see below), but it's unneeded for updating.

    - uses: cachix/install-nix-action@v21
      with:
        extra_nix_config: |
          access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
          # Use the binary cache configured in `nixConfig` section
          accept-flake-config = true
piotrkwiecinski commented 1 year ago

@zonuexe I have updated PR to use https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#push-using-ssh-deploy-keys

Please generated a SSH key and add private key as SSH_PRIVATE_KEY in GitHub action secrets.

This should be good enough for us.

zonuexe commented 1 year ago

I generated a new SSH key and set it as deploy key and secrets.SSH_PRIVATE_KEY.

zonuexe commented 1 year ago

Thank you all.