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

my workflow for recent activity is not working. #80

Closed
kholdarboev opened this issue May 17, 2022 · 11 comments
Closed

my workflow for recent activity is not working. #80

kholdarboev opened this issue May 17, 2022 · 11 comments

Comments

@kholdarboev
Copy link

Screenshot 2022-05-16 165905

@kholdarboev
Copy link
Author

image
this is my yml file

@KarmaBlackshaw
Copy link

also having this error

@hi-reeve
Copy link

got this error this morning

@pAkalpa
Copy link

pAkalpa commented Aug 5, 2022

Same Here

@fbuireu
Copy link

fbuireu commented Aug 11, 2022

Any update on this?

@NyanKaungSet
Copy link

Any update on this?

I had faced the same problem. But I solved the problem eventually. Here are my codes.

YML file

name: Update README

on:
  schedule:
    - cron: '*/30 * * * *'
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    name: Update this repo's README with recent activity

    steps:
      - uses: actions/checkout@v2
      - uses: jamesgeorge007/github-activity-readme@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Copy all the codes. If you only copy and paste the <start section> and <end section> in README file. It will not be work.

# :zap: Recent Activity

<!--START_SECTION:activity-->
1. 🎉 Merged PR [#90](https://github.com/CartimDraluc/Cartimpedia/pull/90) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
2. 💪 Opened PR [#90](https://github.com/CartimDraluc/Cartimpedia/pull/90) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
3. 🗣 Commented on [#89](https://github.com/CartimDraluc/Cartimpedia/issues/89) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
4. ❗️ Closed issue [#89](https://github.com/CartimDraluc/Cartimpedia/issues/89) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
5. ❗️ Opened issue [#89](https://github.com/CartimDraluc/Cartimpedia/issues/89) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
<!--END_SECTION:activity-->

Here is my repo : https://github.com/NyanKaungSet/Github-Workflow/blob/master/README.md#Recent_Actvity

If the workflow failed, make sure you created GITHUB_TOKEN with following scopes in your Personal access tokens.

  • admin:public_key
  • gist
  • notifications
  • workflow
  • write:packages

I hoped this may be helpful.

@fbuireu
Copy link

fbuireu commented Aug 16, 2022

I had faced the same problem. But I solved the problem eventually. Here are my codes.

YML file

name: Update README

on:
  schedule:
    - cron: '*/30 * * * *'
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    name: Update this repo's README with recent activity

    steps:
      - uses: actions/checkout@v2
      - uses: jamesgeorge007/github-activity-readme@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Copy all the codes. If you only copy and paste the <start section> and <end section> in README file. It will not be work.

# :zap: Recent Activity

<!--START_SECTION:activity-->
1. 🎉 Merged PR [#90](https://github.com/CartimDraluc/Cartimpedia/pull/90) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
2. 💪 Opened PR [#90](https://github.com/CartimDraluc/Cartimpedia/pull/90) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
3. 🗣 Commented on [#89](https://github.com/CartimDraluc/Cartimpedia/issues/89) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
4. ❗️ Closed issue [#89](https://github.com/CartimDraluc/Cartimpedia/issues/89) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
5. ❗️ Opened issue [#89](https://github.com/CartimDraluc/Cartimpedia/issues/89) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
<!--END_SECTION:activity-->

Here is my repo : https://github.com/NyanKaungSet/Github-Workflow/blob/master/README.md#Recent_Actvity

If the workflow failed, make sure you created GITHUB_TOKEN with following scopes in your Personal access tokens.

  • admin:public_key
  • gist
  • notifications
  • workflow
  • write:packages

I hoped this may be helpful.

I can confirm that it is still not working.

Here is the last output using the same configuration you mentioned:

Run jamesgeorge007/github-activity-readme@master
⬤  debug     Getting activity for fbuireu
⬤  debug     Activity for fbuireu, [10](https://github.com/fbuireu/fbuireu/runs/7861274323?check_suite_focus=true#step:3:11)0 events found.
✔  success   Wrote to README
⬤  debug     Something went wrong
✖  fatal     Error: Invalid status code: 1 
    at ChildProcess.<anonymous> (/home/runner/work/_actions/jamesgeorge007/github-activity-readme/master/dist/index.js:1530:15)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Socket.<anonymous> (internal/child_process.js:444:[11](https://github.com/fbuireu/fbuireu/runs/7861274323?check_suite_focus=true#step:3:12))
    at Socket.emit (events.js:314:20)
    at Pipe.<anonymous> (net.js:675:[12](https://github.com/fbuireu/fbuireu/runs/7861274323?check_suite_focus=true#step:3:13))

My GITHUB_TOKEN has the exact permissions you mentioned and following the stack trace of the error, where success appears (✔ success) it doesn't look like permission issues.

Moreover, my README.md file has the comments needed by the action:

### Latest Activity
<!--START_SECTION:activity-->
<!--END_SECTION:activity-->

@NyanKaungSet
Copy link

I can confirm that it is still not working.

As I mentioned above, Your README file only have these lines.

<!--START_SECTION:activity-->
<!--END_SECTION:activity-->

Delete those 2 lines and add the following codes. Save it and run the workflow. If this still doesn’t work, I will fork your repo and try from my side.

<!--START_SECTION:activity-->
1. 🎉 Merged PR [#90](https://github.com/CartimDraluc/Cartimpedia/pull/90) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
2. 💪 Opened PR [#90](https://github.com/CartimDraluc/Cartimpedia/pull/90) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
3. 🗣 Commented on [#89](https://github.com/CartimDraluc/Cartimpedia/issues/89) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
4. ❗️ Closed issue [#89](https://github.com/CartimDraluc/Cartimpedia/issues/89) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
5. ❗️ Opened issue [#89](https://github.com/CartimDraluc/Cartimpedia/issues/89) in [CartimDraluc/Cartimpedia](https://github.com/CartimDraluc/Cartimpedia)
<!--END_SECTION:activity-->

@fbuireu
Copy link

fbuireu commented Aug 16, 2022

Sorry, but it doesn't make sense at all what you are suggesting. Everything wrapped by <!--START_SECTION:activity--> is replaced by the action's code (what extracts from GitHub's activity). If that was the problem, it would never work because it would be never able to replace the content inside the <!--START_SECTION:activity--> section.

I've also tried just to be sure, and it doesn't work, indeed.

I have my own version of the action (see #79) where we add a TARGET_FILE option, but I've also tried using the base configuration (the default one) and the one you suggested, and it still doesn't work. Feel free to fork if you want.

@fbuireu
Copy link

fbuireu commented Aug 17, 2022

For those who are facing this issue:

Run jamesgeorge007/github-activity-readme@master
⬤  debug     Getting activity for fbuireu
⬤  debug     Activity for fbuireu, [10](https://github.com/fbuireu/fbuireu/runs/7861274323?check_suite_focus=true#step:3:11)0 events found.
✔  success   Wrote to README
⬤  debug     Something went wrong
✖  fatal     Error: Invalid status code: 1 
    at ChildProcess.<anonymous> (/home/runner/work/_actions/jamesgeorge007/github-activity-readme/master/dist/index.js:1530:15)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Socket.<anonymous> (internal/child_process.js:444:[11](https://github.com/fbuireu/fbuireu/runs/7861274323?check_suite_focus=true#step:3:12))
    at Socket.emit (events.js:314:20)
    at Pipe.<anonymous> (net.js:675:[12](https://github.com/fbuireu/fbuireu/runs/7861274323?check_suite_focus=true#step:3:13))

After a long debugging, it seems that the issue is related to the permissions or security of the repo/branch. The CI GitHub action works as intended (see ✔ success message) however, it seems that after that, is not able to push or to apply the changes to the given file and because of the lack of debug errors it's easy to lose the trace of the issue.

Make sure that you are not locking or protecting the main/master branch whatsoever. Personally, I think that it should be added as a feature to bypass or to have a security feature to write in the protected branches (that's why the token is) but in the meantime, this is a workaround.

After I removed the protections, the action worked as intended.

image

@tuunit
Copy link
Collaborator

tuunit commented May 30, 2023

Just add the following permission flag to allow github actions to update the contents of your repository:

name: GitHub Activity

on:
  workflow_dispatch:
  schedule:
    - cron: "0 0 * * *"

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v3
      - uses: jamesgeorge007/github-activity-readme@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

This way a token with write/commit privileges will be created. I have changed the README.md to reflect this necessary change.

@tuunit tuunit closed this as completed May 30, 2023
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

No branches or pull requests

7 participants