Git Product home page Git Product logo

gautamkrishnar / keepalive-workflow Goto Github PK

View Code? Open in Web Editor NEW
163.0 4.0 28.0 616 KB

GitHub action to prevent GitHub from suspending your cronjob based triggers due to repository inactivity

Home Page: https://github.com/marketplace/actions/keepalive-workflow

License: GNU General Public License v3.0

JavaScript 100.00%
github-actions github automation cronjob actions trigger hacktoberfest

keepalive-workflow's Issues

Workflow being disabled even though v2 is in use

This is apparently different from @julienloizelet 's

I just got the warning from GitHub that my workflows on https://github.com/rfay/ddev-drushonhost are about to be disabled.

As you can see there the scheduled tests have been running; there's only one workflow, and it's using v2 of this action.

This is using https://github.com/ddev/github-action-add-on-test v2, which uses gautamkrishnar/keepalive-workflow v2

I'd love to know what you think is going on.

I do have other projects with identical single workflow (like https://github.com/ddev/signing_tools/ and https://github.com/ddev/ddev-redis-commander ) that are now more than 2 months out and not disabled yet.

Unexpected input(s) 'use_api' during action run

I followed the documentation and here is the link to my YAML file. For some reason, the step is skipped and it seems like it doesn't do anything. Assistance would be greatly appreciated. I would prefer not to create any new commits.

image

My PAT has the following access:
Github Action - Keep Alive โ€” admin:repo_hook, repo, workflow

Any assistance / directions would be greatly appreciated. Thanks in advance!

"unable to access" issue in multiple projects.

Thank you for the creating this action.
I have several open-source projects that use this action to test against an upstream stable/head builds.

About a week ago, I started recieving email notifications of tests failing:

{
    "command": "git push origin HEAD",
    "exitCode": 128,
    "outputData": "",
    "errorData": "remote: Permission to tyler[3](https://github.com/tyler36/ddev-tinker/actions/runs/5162752635/jobs/9315661265#step:12:3)6/ddev-tinker.git denied to github-actions[bot].\nfatal: unable to access 'https://github.com/tyler36/ddev-tinker.git/': The requested URL returned error: [4](https://github.com/tyler36/ddev-tinker/actions/runs/5162752635/jobs/9315661265#step:12:4)03\n"
}
with:
    gh_token: ***
    commit_message: Automated commit by Keepalive Workflow to keep the repository active
    committer_username: gkr-bot
    committer_email: [email protected]
    time_elapsed: 50
    auto_push: true
  env:
    NIGHTLY_DDEV_PR_URL: https://nightly.link/ddev/ddev/actions/runs/1720215802/ddev-linux-amd64.zip
    DDEV_GITHUB_TOKEN: ***
    HOMEBREW_NO_INSTALL_FROM_API: 1

Link to workflow.yml

[Question] Write Permission check

Hi,

First, thanks for this very useful action.

Then, a few remarks:

since the release 1.2.0 (including this commit ), almost all my Keep Alive workflows no longer work because I protect the main branch on almost all my projects.

I guess I can solve it by setting auto_write_check to false (did no test yet, am I right ?).

Setting the default value of auto_write_check to true is a kind of breaking change for me, and I would have prefer a @v2 maybe (or still a @v1 if the default value is false).

Finally, my question is:

Is it normal that, even if we set explicitly the write permission in the workflow, the Keep alive step will throw an error ?

For example,

I'm using this generic action :

name: Keep Alive
on:

 schedule:
    - cron: '0 0 * * *'

permissions:
  contents: write

jobs:
  keep-alive:

    name: Keep Alive
    runs-on: ubuntu-latest

    steps:

      - name: Clone project files
        uses: actions/checkout@v3

      # keepalive-workflow adds a dummy commit if there's no other action here, keeps
      # GitHub from turning off tests after 60 days
      - uses: gautamkrishnar/keepalive-workflow@v1
        with:
          commit_message: "chore(*): Automated commit to keep the repository active"
          time_elapsed: 55

And it fails (because I protected the main branch) even if there is the permissions:contents: write directive.

Thanks

denied by branch protections

Wondering what is the best way to work around branch protections?

Error: {"command":"git push origin HEAD","exitCode":1,"outputData":"","errorData":"remote: error: GH006: Protected branch update failed for refs/heads/dev.        \nremote: error: At least 1 approving review is required by reviewers with write access. 2 of 2 required status checks are expected.

Use branch "keep-alive"

The action should not use the current main branch, but some other branch.

I know that with additional steps, this should be possible. Maybe, this should be documented in the README.md. Maybe, it is as simple as

- run: git checkout -b keep-alive

Add keepalive using GitHub actions API

Now GitHub supports re-enabling the workflows using GitHub API.

gh api -X PUT repos/{ repo }/actions/workflows/{ actionFile }/enable

ToDo

  • Provide API for action developers to use this approach
  • Add this as an option to the keepalive workflow

ref: #1

Please update Release 2.0 to say explicitly what needs to change

in https://github.com/gautamkrishnar/keepalive-workflow/releases/tag/2.0.0 you say

People who are using v1 and master tags of this workflow will continue using the dummy commit method since the newly added API-based method requires explicit permission for the API Keys for it to function.

but you don't mention what permission has to be changed.

It looks to me like you're saying that

permissions:
  contents: write

must be changed to:

permissions:
  actions: write

Could you please just show the simple change of an action in the release notes (and probably in the README?)

Thanks for all the work on this!

My workflow has been disabled even if I use this action

Hi,

Am I doing something wrong or is this a bug ?

Every week, I run the v2 version of this action using a simple "Keep Alive" action: https://github.com/julienloizelet/ddev-tools/actions/workflows/keepalive.yml

I use it so that another "test" action is not disabled:

https://github.com/julienloizelet/ddev-tools/actions/workflows/tests.yml

But, it has been disabled today:


Screenshot 2024-05-14 at 16 36 32

I don't see any error in the Keep Alive workflow:


Screenshot 2024-05-14 at 16 39 28

But despite this, the "test" action has been deactivated.

Do you have an idea of what could be the reason of this behavior ?

Thanks !

Documentation on the impact of a "Dummy commit"

Hi, this could be what a lot of people are looking for!

I think it would be really beneficial to add some documentation on the pros and cons of the dummy commit. There may not be any cons but always good to reassure your users. ๐Ÿ˜Š

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.