Skip to content

Commit

Permalink
ci: Updated workflow to use PAT secret and autocommit actiong (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
Carsopre authored Apr 15, 2024
1 parent cd8c579 commit fe0b26e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/normalize_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Check out
uses: actions/checkout@v4
with:
token: "${{ secrets.GITHUB_TOKEN }}"
token: ${{ secrets.PAT }}
fetch-depth: 0

- name: Set up Python
Expand Down Expand Up @@ -52,13 +52,12 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'

- name: Autoformat code if the check fails
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: |
poetry run isort .
poetry run black .
git config --global user.name '${{ github.actor }}'
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
git commit -am "chore: autoformat isort & black" && git push --force || true
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: autoformat isort & black"
push_options: --force

0 comments on commit fe0b26e

Please sign in to comment.