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] CI Worklfow not being able to push changes #2411

Open
Panquesito7 opened this issue Dec 21, 2022 · 4 comments
Open

[BUG] CI Worklfow not being able to push changes #2411

Panquesito7 opened this issue Dec 21, 2022 · 4 comments
Assignees
Labels
bug dont-close This issue/pull request shouldn't be closed

Comments

@Panquesito7
Copy link
Member

Description

The Awesome Workflow makes changes to format files or to change the DIRECTORY.md, and then pushes the changes to the master branch.
However, that branch is a protected branch, which means only administrators or certain permitted users can make changes without creating a PR. AFAIK, GitHub Actions cannot be given permissions.

https://github.com/TheAlgorithms/C/actions/runs/3728181169/jobs/6322964878#step:11:19
https://github.com/orgs/community/discussions/25305

Expected behavior

The CI should normally push the changes.

Actual behavior

The CI cannot push any changes to the master branch.

Steps to reproduce

No response

Context

This is very important when updating the DIRECTORY.md file, when formatting files, etc.. Without these, the files may be unformatted or have filenames that do not follow our guidelines and other stuff that the CI takes care of.

Additional information

No response

@Panquesito7 Panquesito7 added bug help wanted Extra attention is needed labels Dec 21, 2022
@github-actions

This comment was marked as outdated.

@github-actions github-actions bot added the stale Author has not responded to the comments for over 2 weeks label Jan 21, 2023
@Panquesito7 Panquesito7 added dont-close This issue/pull request shouldn't be closed and removed stale Author has not responded to the comments for over 2 weeks labels Jan 24, 2023
@Panquesito7 Panquesito7 self-assigned this Jan 24, 2023
@realstealthninja
Copy link
Collaborator

realstealthninja commented Apr 27, 2023

I'm not quite knowledgeable in CI but I've seen the algorithms/python update their DIRECTORY.md file using a CI.
I think they are using a GitHub secret token to push things to the directory file i am not sure.
I have also seen pre-commit also manage to push changes into the current pull request. I'll do some more researching and I'll let you know how it goes. Hope this helps 🙂
Maybe something like this might just work:

-name: Commit and push changes
         run: |
           git diff DIRECTORY.md
           git commit -am "clang-format and clang-tidy fixes for ${GITHUB_SHA::8}" || true
           git remote set-url origin https://x-access-token:$GH_TOKEN@github.com/$GITHUB_REPOSITORY
           git push origin HEAD:refs/heads/main --tags
         env:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

@Panquesito7
Copy link
Member Author

Thanks. @tjgurwara99 and I are working on this.

@Panquesito7 Panquesito7 removed the help wanted Extra attention is needed label Apr 27, 2023
@realstealthninja
Copy link
Collaborator

Happy to help! Best of luck 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dont-close This issue/pull request shouldn't be closed
Projects
None yet
Development

No branches or pull requests

3 participants