Skip to content

CI: Add workflow to avoid scheduled workflows becoming disabled #18

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

Merged

Conversation

matthewfeickert
Copy link
Member

@matthewfeickert matthewfeickert commented Jun 9, 2023

Resolves #17

Run a cron job on a monthly basis that force pushes a commit to a keep-alive branch.

(There might be more interesting or intelligent ways to do this, but this works. Revisions welcome!)

@matthewfeickert matthewfeickert self-assigned this Jun 9, 2023
Comment on lines +23 to +26
- name: Create a minimal payload
run: |
mkdir _pass
touch _pass/pass.txt
Copy link
Member Author

Choose a reason for hiding this comment

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

peaceiris/actions-gh-pages requires a non-empty payload directory, so this just provides payload of an empty file.

touch _pass/pass.txt

- name: Keep workflow alive
uses: peaceiris/actions-gh-pages@v3
Copy link
Member Author

Choose a reason for hiding this comment

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

I think the security risk of using a @v3 tag here is probably fine as we aren't deploying thing, but as we are pushing back to the repo I can see some motivation to go with a more security cautious approach. I'll defer to others here.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see why this is less risky than other cases: the action gets your secret and can push a new tag to do anything with it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think what @matthewfeickert is @v3 pins to any v3, while @v3.9.1 or @<commit-ish> would pin to a given version so if upstream is compromised we are safe.

Copy link
Member

Choose a reason for hiding this comment

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

Presumably v3.9.1 is a tag, so only hashes are secure in this sense?

Copy link
Member Author

Choose a reason for hiding this comment

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

the action gets your secret and can push a new tag to do anything with it.

The default GITHUB_TOKEN secret created by GitHub Actions at runtime has its permissions limited to the repository that contains the workflow. So it can't perform arbitrary actions. Though, it can write (and so rewrite) commits, so given that

so only hashes are secure in this sense?

yes, probably.

publish_branch: keep-alive
publish_dir: _pass
enable_jekyll: true # avoid extra files
force_orphan: true # overwirte
Copy link
Member Author

Choose a reason for hiding this comment

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

force pushes to the branch

* Run a cron job on a monthly basis that force pushes a commit to a
  keep-alive branch.
@matthewfeickert matthewfeickert force-pushed the ci/add-keep-alive-workflow branch from 09fcc14 to 336ab09 Compare June 9, 2023 21:15
Comment on lines +36 to +37
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
Copy link
Member Author

Choose a reason for hiding this comment

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

Avoids the commit being associated with a real user (this really doesn't matter much IMO, but some people like it to make it clear that "hey this wasn't me this was an automated system").

Copy link
Member

@stefanv stefanv left a comment

Choose a reason for hiding this comment

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

This looks good, thanks!

Any reason not to use the official GH pages action?

touch _pass/pass.txt

- name: Keep workflow alive
uses: peaceiris/actions-gh-pages@v3
Copy link
Member

Choose a reason for hiding this comment

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

I don't see why this is less risky than other cases: the action gets your secret and can push a new tag to do anything with it.

@jarrodmillman jarrodmillman added this to the 0.2.0 milestone Jun 10, 2023
@Carreau Carreau merged commit b1c5a48 into scientific-python:main Jun 12, 2023
@matthewfeickert matthewfeickert deleted the ci/add-keep-alive-workflow branch June 13, 2023 06:04
@matthewfeickert
Copy link
Member Author

Any reason not to use the official GH pages action?

@stefanv If you mean https://github.com/actions/deploy-pages, that GitHub Action doesn't allow for configuration of the target branch. It will only deploy to the gh-pages branch, but if we want the ability to reserve that for later use we need to target a different branch which peaceiris/actions-gh-pages allows.

@stefanv
Copy link
Member

stefanv commented Jun 13, 2023

That makes sense, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid scheduled workflows becoming disabled due to lack of repo activity
4 participants