Skip to content

workflows: replace API calls from bash with github-script#412659

Merged
wolfgangwalther merged 3 commits intoNixOS:masterfrom
wolfgangwalther:ci-github-script
Jun 1, 2025
Merged

workflows: replace API calls from bash with github-script#412659
wolfgangwalther merged 3 commits intoNixOS:masterfrom
wolfgangwalther:ci-github-script

Conversation

@wolfgangwalther
Copy link
Contributor

For a while, all new API calls in workflows were written with actions/github-script. This PR is a refactor to rewrite the remaining bash scripts with it as well. For a little bit of background, see #412068 (comment). TLDR: github-script supports context natively, thus discouraging possibly insecure string interpolation.

The eval workflow's "wait for target run" script is using a slightly different approach. Instead of waiting for the completion status of that run, it just checks for the availability of artifacts for download. This is the same approach that the newly introduced reviewers.yml workflow uses and results in a bit simpler code, because fewer different API requests need to be made.

Things done


Add a 👍 reaction to pull requests you find important.

Granting the "issues: write" permission allows creating the "port to
stable" label, if it doesn't exist, yet. This avoids failing the
workflow when testing in a fork without that label.
After the stats were added with a header, the list of packages now
appeared directly below it, without any separation.
@github-actions github-actions bot added 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 backport release-25.05 labels May 31, 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 May 31, 2025
github-script provides a better way to access the workflow's context
than bash variables + interpolation. Especially when considering future
changes, where you'll always be tempted to just use interpolation
directly in bash code.
@wolfgangwalther
Copy link
Contributor Author

I applied my newly gained knowledge about pagination to the API call to fetch labels as well. Many labels - no problem!

Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

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

Super nifty.

Copy link
Contributor

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

🚀

@wolfgangwalther wolfgangwalther merged commit b429336 into NixOS:master Jun 1, 2025
23 of 25 checks passed
@wolfgangwalther wolfgangwalther deleted the ci-github-script branch June 1, 2025 10:05
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Jun 1, 2025

Successfully created backport PR for release-24.11:

@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Jun 1, 2025

Git push to origin failed for release-24.11 with exitcode 1

@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Jun 1, 2025

Successfully created backport PR for release-25.05:

@github-actions github-actions bot added the 8.has: port to stable This PR already has a backport to the stable release. label Jun 1, 2025
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Jun 1, 2025

Git push to origin failed for release-25.05 with exitcode 1

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 8.has: port to stable This PR already has a backport to the stable release. 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.

3 participants