Skip to content

Restrict AWS cost workflow to parent repository and fix fork check#10060

Open
najamulsaqib wants to merge 2 commits into
nilbuild:masterfrom
najamulsaqib:master
Open

Restrict AWS cost workflow to parent repository and fix fork check#10060
najamulsaqib wants to merge 2 commits into
nilbuild:masterfrom
najamulsaqib:master

Conversation

@najamulsaqib

Copy link
Copy Markdown

This pull request introduces a small change to the GitHub Actions workflow for AWS cost reporting. The workflow will now only run on the main repository and not on forks, preventing unnecessary execution in forked repositories.

Add a job-level condition to prevent the workflow from running in forks.

Forks do not have access to the required secrets (AWS credentials, Slack
token/channel), so the job would fail silently or with auth errors if
triggered there. The condition checks that the current repository matches
the original repository, ensuring the workflow only runs in the parent.
Replace the previous fork check with github.event.repository.fork == false.

The previous condition (github.repository == github.event.repository.full_name)
does not work reliably with workflow_dispatch as the event repository context
is not fully populated for manual runs. The new condition directly checks
whether the repository is a fork, which works consistently across both
scheduled and manual triggers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant