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

Avoid checking out on forks #622

Closed
wants to merge 1 commit into from
Closed

Avoid checking out on forks #622

wants to merge 1 commit into from

Conversation

claudioandre-br
Copy link
Member

@claudioandre-br claudioandre-br commented Nov 17, 2024

Describe your changes

In the case of PRs from forks, it might be a bad idea to run a check out. Remove that.

From docs:

  • GitHub Actions have imposed restrictions on workflow runs triggered by public repository forks.
  • Checking out a branch from a different repository from where the workflow is executing will make that repository the target.

In short, a 'checkout' can confuse the GitHub API.

Checklist before requesting a review

  • I checked that all workflows return a success.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.
  • I followed the Conventional Commit spec.

Maintainer tasks

  • Label as either: bug, ci, docker, documentation, enhancement.
  • Sign unsigned commits.

@claudioandre-br claudioandre-br added the ci Continuous integration and/or continuous delivery label Nov 17, 2024
@claudioandre-br
Copy link
Member Author

Using a syntax like this, I don't even need to be in the repository:

PR_URL="https://github.com/openwall/john-packages/pull/622"
$ gh pr view "$PR_URL" --json headRefName        --jq '.headRefName'

In the case of PRs from forks, it might be a bad idea to run a check out.
Remove that.

From docs:
- GitHub Actions have imposed restrictions on workflow runs triggered by
  public repository forks.
- Checking out a branch from a different repository from where the workflow
  is executing will make that repository the target.

In short, a 'checkout' can confuse the GitHub API.

Signed-off-by: Claudio André <[email protected]>
@claudioandre-br
Copy link
Member Author

I tested it outside a git repository and it worked:

$ git log
fatal: not a git repository (or any of the parent directories): .git

$ gh pr view "$URL_ID" --json headRepository       --jq '.headRepository.name'
john-packages

$ echo $URL_ID
https://github.com/openwall/john-packages/pull/622

Let's push and pray.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Auto approved PR

Copy link
Member Author

@claudioandre-br claudioandre-br left a comment

Choose a reason for hiding this comment

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

bot: MERGE trial

@claudioandre-br
Copy link
Member Author

This 'idea' works:

Superseded by #625.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous integration and/or continuous delivery
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant