-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GitHub workflow for automatically updating index.js
#187
Conversation
The "Check no dist update" workflow fails because this pull request intentionally creates the initial version of |
This reduces the default permissions for these workflows, see https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
@bigdaz, could you please have a look and let me know what you think about this approach and the implementation? |
Thanks for this: it looks good in general. |
To solve the problem this pull request tries to address, it probably needs two directories, one where the regular build is writing files to (currently
Yes I think that should be possible. Maybe a name starting with |
Not really. We could use |
Sorry for not having updated this pull request yet, I will try to do so in the next days. |
Thanks @Marcono1234 I've adapted this PR to implement similar functionality in https://github.com/gradle/actions/blob/main/.github/workflows/ci-update-dist.yml It's working pretty well and has simplified the development process, so thanks a lot for the inspiration! You're right that it's probably not worth working on it here, since the when #198 is complete there will no longer be any 'dist' directory in this repository. |
Ok, I will close this pull request then. I am glad the changes proposed by this pull request were useful for you nonetheless though. |
See discussion starting at #175 (comment)
This pull request changes the workflows so that:
dist/index.js
(respectively the now namedaction/index.js
)main
branch will build and updateaction/index.js
if needed, and push the changes as separate commitTo achieve this, the
dist/index.js
is now ignored by Git and is instead copied toaction/index.js
by CI. This prevents users accidentally committing that file when creating pull requests.Here is an example workflow run which detected changes and created a commit:
Limitations:
action/index.js
does not trigger any other workflows, see action documentationmain
is a protected branch (which it probably should be?), see action documentation(might depend on who is the "actor" triggering the workflow; so maybe if a member who is allowed to push to protected branches merged the pull request to
main
, then it works without additional configuration?)Feedback is appreciated! If this is not an approach you want to use, feel free to close this pull request.