I have a django authentication application, I am currently creating a ci/cd for it so when any change is pushed to my remote github repo it would be reflected on the live server
I created a simple file in the root dir called init.py which only does one thing –> hold the current version of the application. so for instance at the beginning its 1.0.0 and with changes it would updated to 1.0.1 or 1.1.0 etc… , just to keep track of the updates
init.py
__version__ = "1.0.0"
now I created github actions workflow that would do the next, when a push request is made it would check the commit message if he commit message contains the word “patch” the workflow would change the version in the init.py by adding one to the patch slot 1.0.0 –> 1.0.1, if the message contains the word “minor” 1.0.0 –> 1.1.0
now I want the workflow which made changes to the init.py file to push this change to my github repository, like literally any normal push request
but I am getting this error
remote: Permission to TheHunter597/djangoAuthApp.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/TheHunter597/djangoAuthApp.git/': The requested URL returned error: 403
I have tried so many things here is some
1- created PAS (personal access token) (I have given this PAS every permission possible I checked all the boxes available) and tried to use it ( here the personal access token is stored inside the environment variable called GH_PAT )
- name: update git repo
continue-on-error: true
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "TheHunter597"
git remote set-url origin https://x-access-token:${GH_PAT}@github.com/TheHunter597/djangoAuthApp.git
git add .
git commit -m "Bump version to ${{ steps.get_required_version.outputs.version }} [skip ci]"
git push
2- tried to login using username and PAS
- name: update git repo 5
continue-on-error: true
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "TheHunter597"
git remote set-url origin https://TheHunter597:[email protected]/TheHunter597/djangoAuthApp.git
git push
3- tried to login using username and password
- name: update git repo 7
continue-on-error: true
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "TheHunter597"
git remote set-url origin https://TheHunter597:${{secrets.PASSWORD}}@github.com/TheHunter597/djangoAuthApp.git
git push
4- tried to login to github using gh and GITHUB_TOKEN
- name: update git repo 8
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "TheHunter597"
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
git push
all of them give the same error, here is my latest github actions workflow latest workflow run
please note that all these changes are done on the formatting-tests branch formatting-tests branch
My github actions file
There is absolutely something that I am missing here, thanks for help 🙂