dfinity / snsdemo

Developer focused SNS deployment demo
15 stars 6 forks source link

Use the access token when committing formatting changes #368

Closed dskloetd closed 3 months ago

dskloetd commented 3 months ago

Motivation

When the GitHub workflow commits formatting changes, it doesn't retrigger the CLA. To make this work we need to use the personal access token. Similar to how we do it on gix-components.

Changes

  1. Check if the access token is available
  2. If so, use it for checkout out the code, and later commit changes.
  3. If not, just fail if changes were required.
  4. Remove the ref: ${{ github.event.pull_request.head.ref }} parameter in case of pull requests. It's needed for the newer version of EndBug but would result in having to have 4 different conditional checkout steps.

Note that I had to use the same older version of EndBug/add-and-commit@v7.2.0 that gix-components uses because with EndBug/add-and-commit@v9.1.1 I get: https://github.com/dfinity/snsdemo/actions/runs/9594195671/job/26456241660

Error: Error: fatal: You are not currently on a branch.