Skip to content

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

Closed
JohnRTitor wants to merge 1 commit intoNixOS:masterfrom
JohnRTitor:periodic-merge-bot-change
Closed

workflows/periodic-merges: use nix-backport app's token when merging#372041
JohnRTitor wants to merge 1 commit intoNixOS:masterfrom
JohnRTitor:periodic-merge-bot-change

Conversation

@JohnRTitor
Copy link
Member

@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 Discuss policies to work in and around Nixpkgs 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.

@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 <50095635+JohnRTitor@users.noreply.github.com>
@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
Member 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
Member 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
Member 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 Discuss policies to work in and around Nixpkgs 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