dfinity / snsdemo

Developer focused SNS deployment demo
15 stars 6 forks source link

Combine access token and pull request checks in workflow #380

Closed dskloetd closed 2 months ago

dskloetd commented 2 months ago

Motivation

EndBug/add-and-commit requires that the checkout action is called with ref, when used on a pull request, so it knows which branch to commit to. For some reason this was not required on older versions (7) of EndBug/add-and-commit.

In https://github.com/dfinity/snsdemo/pull/368 I changed to an earlier version of EndBug/add-and-commit to avoid having to pass ref to the checkout action, depending on whether the run is for a PR, to avoid having to have 4 different checkout steps. I realized now that I only need to pass the token if I plan to make changes, so I can combine the checkout steps and still only have 2 while also using newer versions of actions/checkout and EndBug/add-and-commit.

Changes

  1. Check whether commits can be added based on both the presence of the PAT token and the even being for a PR.
  2. Use actions/checkout@v4 and EndBug/add-and-commit@v9.1.4.

Tested

PR from a forked repo:

From this PR: