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

BUG - GH action workflows fixes #1970

Merged
merged 4 commits into from
Sep 3, 2024

Conversation

trallard
Copy link
Collaborator

@trallard trallard commented Sep 2, 2024

There are a couple of fixes in this PR:

  1. The publish action has been failing due to the permissions needed by the coverage action (see https://github.com/pydata/pydata-sphinx-theme/actions/runs/10659690328/workflow). This should add the missing permissions for that specific workflow - note this is needed as when the workflow is not triggered from a Pull Request then the coverage data is pushed to a branch in the repo (but the main CI workflow still needs PR permissions 🤷🏽‍♀️, permissions are weird).
  2. There is a breaking change in the upload-artifact action which is making our workflows fail now

@trallard trallard added kind: bug Something isn't working tag: CI Pull requests that update GitHub Actions code labels Sep 2, 2024
@trallard trallard marked this pull request as draft September 2, 2024 16:30
@@ -91,6 +91,7 @@ jobs:
name: coverage-data-${{ matrix.python-version }}
path: .coverage
if-no-files-found: ignore
include-hidden-files: true
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actions/upload-artifact recently added this key which broke the upload for .coverage

Copy link
Collaborator

Choose a reason for hiding this comment

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

curious if they said why they default to false, thereby breaking backward compatibility?

Copy link

github-actions bot commented Sep 3, 2024

Coverage report

This PR does not seem to contain any modification to coverable code.

@trallard trallard marked this pull request as ready for review September 3, 2024 13:58
@trallard trallard changed the title BUG - Fix publish workflow permissions BUG - GH action workflows fixes Sep 3, 2024
@@ -91,6 +91,7 @@ jobs:
name: coverage-data-${{ matrix.python-version }}
path: .coverage
if-no-files-found: ignore
include-hidden-files: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

curious if they said why they default to false, thereby breaking backward compatibility?

Comment on lines +23 to +26
# needed for the coverage action
permissions:
contents: write
pull-requests: write
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm slightly confused why this is needed even though the coverage job has a if: github.event.workflow_run.event != 'release' clause. But as you say, permissions are weird. I think you were saying it's because coverage runs anyway (for some reason) and pushes the coverage data to a new branch? Would be nice to just make it so that coverage doesn't try to run at all on release workflows... but I'm assuming that since you're not doing that here, it's probably not that simple. 🤷🏻

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It all seems to come from the fact that we have the coverage step within our main CI workflow, which is in turn called by the release workflow.
So even if the coverage comment part is not triggered per se, GH actions checks that the permissions granted within the caller workflow (release) and the called one (CI) match.

The one way I could think of decoupling these workflows would be to split the tests and docs building jobs into a reusable action and call that within the CI and release workflows independently but that seemed like too much hassle.
I can do that if you see it as worthwhile.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah ok, now I get it. thanks for explaining. I agree that splitting into reusable actions seems not worth the hassle... I recall last time I tried to do that it was a pain and I gave up :)

@drammock drammock merged commit 7ed0ca4 into pydata:main Sep 3, 2024
29 checks passed
@trallard
Copy link
Collaborator Author

trallard commented Sep 4, 2024

@drammock the changes in the action are from a security POV to prevent credential/secret files to be accidentally uploaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working tag: CI Pull requests that update GitHub Actions code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants