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

Make CI run checkout PR for backlogger_preview #42

Merged
merged 2 commits into from Apr 29, 2024

Conversation

b10n1k
Copy link
Collaborator

@b10n1k b10n1k commented Apr 22, 2024

Switch trigger to pull_request_target and adjust the checkout actions
to run against the latest code in the PR.
Although it works for backlogger, it might impact when the workflow
run in another repository.

https://progress.opensuse.org/issues/158236

Copy link

github-actions bot commented Apr 22, 2024

PR Preview Action v1.4.7
Preview removed because the pull request was closed.
2024-04-29 10:51 UTC

@b10n1k b10n1k force-pushed the workaround_forked_ci branch 17 times, most recently from 3faf854 to f7dc564 Compare April 22, 2024 18:35
@b10n1k b10n1k marked this pull request as ready for review April 22, 2024 18:40
.github/workflows/preview.yaml Outdated Show resolved Hide resolved
action.yaml Outdated
@@ -29,17 +29,13 @@ inputs:
runs:
using: composite
steps:
- uses: actions/checkout@v4
Copy link
Contributor

@perlpunk perlpunk Apr 22, 2024

Choose a reason for hiding this comment

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

Note that this action is not a workflow like the ones under .github/workflows. It provides an action that can be used from other repositories' workflows.
It needs to do a checkout into a different directory.
I don't know right now how to solve the problem, but this won't work.

Copy link
Member

Choose a reason for hiding this comment

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

I would guess ref: ${{ github.event.pull_request.head.sha }} is needed here. Unfortunately GitHub docs don't seem to explain this case?

Someone on stackoverflow suggests github.event.workflow_run.head_sha would work without giving an explanation. And maybe fetch-depth: 2 is needed?

I'm thinking out loud here since that's what I had to look up myself

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@b10n1k b10n1k force-pushed the workaround_forked_ci branch 9 times, most recently from 940835e to 59a4dd9 Compare April 24, 2024 09:34
@b10n1k b10n1k force-pushed the workaround_forked_ci branch 2 times, most recently from 77cda36 to 5466e29 Compare April 24, 2024 19:51
@perlpunk
Copy link
Contributor

I wonder if this can work because the main purpose of the action is to run on the main branch, so there is no github.event.pull_request.head.sha.
I think it should be possible to push this on your fork's main branch and try it out for real, before we merge and have to revert.
Also, I'm wondering if the preview was actually working before...

@b10n1k
Copy link
Collaborator Author

b10n1k commented Apr 25, 2024

I wonder if this can work because the main purpose of the action is to run on the main branch, so there is no github.event.pull_request.head.sha. I think it should be possible to push this on your fork's main branch and try it out for real, before we merge and have to revert. Also, I'm wondering if the preview was actually working before...

i found it hard to run it from my repository. CI fails.

@b10n1k b10n1k force-pushed the workaround_forked_ci branch 2 times, most recently from 9c5e0f2 to 983af2f Compare April 29, 2024 07:47
Switch trigger to pull_request_target and adjust the checkout actions
to run against the latest code in the PR.
Although it works for backlogger, it might impact when the workflow
run in another repository.

https://progress.opensuse.org/issues/158236

Signed-off-by: ybonatakis <ybonatakis@suse.com>
@b10n1k b10n1k force-pushed the workaround_forked_ci branch 5 times, most recently from c6a92d5 to 3b1dcde Compare April 29, 2024 08:48
Copy link
Member

@okurz okurz left a comment

Choose a reason for hiding this comment

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

I see "TEST" on https://opensuse.github.io/backlogger/pr-preview/pr-42/ so I guess this works :)

@b10n1k
Copy link
Collaborator Author

b10n1k commented Apr 29, 2024

I see "TEST" on https://opensuse.github.io/backlogger/pr-preview/pr-42/ so I guess this works :)

it does but i need to understand the I wonder if this can work because the main purpose of the action is to run on the main branch, so there is no github.event.pull_request.head.sha.

@b10n1k b10n1k force-pushed the workaround_forked_ci branch 2 times, most recently from 28d06ec to 553f555 Compare April 29, 2024 10:19
@b10n1k
Copy link
Collaborator Author

b10n1k commented Apr 29, 2024

testing it with @kalikiana we verified it works. we think to merge and see how it will go

Signed-off-by: ybonatakis <ybonatakis@suse.com>
@kalikiana kalikiana dismissed perlpunk’s stale review April 29, 2024 10:30

I checked with Yannis that the TEST change works, and this should address the review remarks

Copy link
Member

@kalikiana kalikiana left a comment

Choose a reason for hiding this comment

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

For reference, this is what it looked like with the TEST change, and after undoing https://github.com/openSUSE/backlogger/compare/3b1dcdee76c956d502539fae68d0528da7a1dc3d..83751c86485e6bfb8dd2b6748ab12add7288e22d which didn't work. I mention it since the proof is a moving target.

image

Copy link
Member

@kalikiana kalikiana left a comment

Choose a reason for hiding this comment

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

Well, something here is fishy. The preview did not change after the TEST change got removed.

@kalikiana
Copy link
Member

image

Hum. Now I do see the update. Is there a delay we need to take into account? And which makes debugging this very confusing?

@kalikiana kalikiana merged commit 27fcb74 into openSUSE:main Apr 29, 2024
2 checks passed
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.

None yet

4 participants