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: pass --repo to relevant gh calls #188086

Merged
merged 1 commit into from
Sep 12, 2024
Merged

workflows: pass --repo to relevant gh calls #188086

merged 1 commit into from
Sep 12, 2024

Conversation

carlocab
Copy link
Member

Letting gh infer the GitHub repository (e.g. from the working
directory) makes it do extra API calls we don't need.

Let's just pass --repo wherever we don't call gh api to avoid this.

While we're here:

  • ensure this is done uniformly using --repo "$GITHUB_REPOSITORY"
  • remove more workflow interpolation into shell script, in line with
    GitHub documentation on security hardening1

Footnotes

  1. https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable

Letting `gh` infer the GitHub repository (e.g. from the working
directory) makes it do extra API calls we don't need.

Let's just pass `--repo` wherever we don't call `gh api` to avoid this.

While we're here:
- ensure this is done uniformly using `--repo "$GITHUB_REPOSITORY"`
- remove more workflow interpolation into shell script, in line with
  GitHub documentation on security hardening[^1]

[^1]: https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
@carlocab carlocab requested review from MikeMcQuaid and a team as code owners September 12, 2024 11:48
@github-actions github-actions bot added workflows PR modifies GitHub Actions workflow files automerge-skip `brew pr-automerge` will skip this pull request labels Sep 12, 2024
Copy link
Member

@Bo98 Bo98 left a comment

Choose a reason for hiding this comment

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

LGTM. Alternative to --repo is setting GH_REPO more globally in the workflow.

.github/workflows/create-replacement-pr.yml Show resolved Hide resolved
.github/workflows/dispatch-rebottle.yml Show resolved Hide resolved
@carlocab
Copy link
Member Author

LGTM. Alternative to --repo is setting GH_REPO more globally in the workflow.

Think we already do do that in most places, but it doesn't seem to stop the extra API calls.

@carlocab carlocab added this pull request to the merge queue Sep 12, 2024
Merged via the queue into master with commit 49bdc00 Sep 12, 2024
20 checks passed
@carlocab carlocab deleted the set-gh-repo branch September 12, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge-skip `brew pr-automerge` will skip this pull request workflows PR modifies GitHub Actions workflow files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants