stefanzweifel / git-auto-commit-action

Automatically commit and push changed files back to GitHub with this GitHub Action for the 80% use case.
MIT License
1.97k stars 226 forks source link

Will the new generated personal access token affect the workflow? #183

Closed edsml-yz1921 closed 2 years ago

edsml-yz1921 commented 2 years ago

Version of the Action v4

Describe the bug GitHub noticed that my personal access token is going to expire. If I regenerate a new and equivalent token, will it affect the original functionality of the workflow?

Expected behavior The workflow execute the python files to generate a new txt file and the action commits and pushes the new file to the repo. After updating the personal access token, new token does not affect the expected behavior.

Used Workflow

# update timings.txt file and push back to the git repo.

name: update_timings_file

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:
    inputs:
      tags:
        description: 'Run this workflow'

jobs:
  update_timings_file:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
      with:
        ref: ${{ github.head_ref }}

    - name: Set up Python 3.9
      uses: actions/setup-python@v1
      with:
        python-version: 3.9

    - name: Install dependencies
      run: |
        pip install --upgrade pip
        pip install -e .
        pip install -r requirements.txt

    - name: Run det_timings.py file
      run: |
        python3 scripts/det_timings.py
      continue-on-error: true

    - name: Git pull
      run: |
        git pull

    - name: Update the documents
      uses: stefanzweifel/git-auto-commit-action@v4
      with:
          commit_message: Auto-generated timings.txt
stefanzweifel commented 2 years ago

Your workflow will be unaffected by a regenerated token, as you do not use a custom GitHub token in your workflow.

Actions issues a new GITHUB_TOKEN at the start of each workflow run, which can be used by steps to authenticate with the GitHub API. (See docs)

The actions/checkout-Action uses the default GITHUB_TOKEN to authenticate the git repository.

As long as you do not override the token argument for the actions/checkout-Action, you're good to go.