Skip to content
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

workflows/periodic-merges: use nix-backport app's token when merging #372041

Closed

Conversation

JohnRTitor
Copy link
Contributor

@JohnRTitor JohnRTitor commented Jan 8, 2025

This will allow GitHub to run actions on those commits, specifically Eval action. Currently as these merges are commited by github-actions, Eval doesn't run on the commits.

ie, https://github.com/NixOS/nixpkgs/actions/runs/12646467735/job/35237397411?pr=371701 Processing failed due to fa2d66f commit was done by github-actions.

With this every periodic merge will be authored and commited by the nix-backports bot. We can reuse the bot here as it has the perms (NixOS/org#38) required here.

@github-actions github-actions bot added 6.topic: policy discussion 6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions labels Jan 8, 2025
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jan 8, 2025
Copy link
Contributor

@wolfgangwalther wolfgangwalther left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be tested in @infinisil's test organization.

.github/workflows/periodic-merge-24h.yml Outdated Show resolved Hide resolved
@JohnRTitor JohnRTitor force-pushed the periodic-merge-bot-change branch from 20835f7 to 7415599 Compare January 8, 2025 07:46
…branches

This will allow GitHub to run actions on those commits, specifically Eval action.
Currently as these merges are commited by `github-actions`, Eval doesn't run on the commits.
ie, https://github.com/NixOS/nixpkgs/actions/runs/12646467735/job/35237397411?pr=371701 failed due to NixOS@fa2d66f commit was done by github-actions.

With this every periodic merge will be authored and commited by the nix-backports bot. We can reuse the bot here as they have similar perms (NixOS/org#38)

Signed-off-by: John Titor <[email protected]>
@JohnRTitor JohnRTitor force-pushed the periodic-merge-bot-change branch from 7415599 to e89759d Compare January 8, 2025 07:46
- uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
id: app-token
with:
app-id: ${{ vars.BACKPORT_APP_ID }}
Copy link
Member

@Mic92 Mic92 Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok from a security perspective. We may want to add variable with a new name for BACKPORT_APP_ID and BACKPORT_PRIVATE_KEY.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are asking because of https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable ?

These (BACKPORT_APP_ID, BACKPORT_PRIVATE_KEY) are set by NixOS org admins I think? So I don't think we have to worry about untrusted inputs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I am not worried about security here. I think the name should just reflect where it's being used and this key is after this change no longer limited to just backport actions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Let's set it to something generic and I will update the variable here.

Instead of nix-backports, can we use nixpkgs-ci?

@infinisil
Copy link
Member

infinisil commented Jan 8, 2025

I've opened NixOS/org#54 to rename the App to "Nixpkgs CI", which when implemented should give us variables NIXPKGS_CI_APP_ID and NIXPKGS_CI_APP_PRIVATE_KEY. All uses of BACKPORT_APP_ID and BACKPORT_PRIVATE_KEY can be switched to the above instead, after that an org owner can unset them.

It would be great to start a little docs section in perhaps ci/README.md on the apps :)

@wolfgangwalther
Copy link
Contributor

It would be great to start a little docs section in perhaps ci/README.md on the apps :)

I guess they could go to .github/workflows/README.md after #371216 is merged, since the "permissions" topic is touched there already.

@JohnRTitor
Copy link
Contributor Author

Done in #373935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions 6.topic: policy discussion 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants