Skip to content

Commit

Permalink
try to reduce the permission; update only translation files (#2291)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludy87 authored Nov 21, 2024
1 parent 4ebeedc commit 32d575b
Showing 1 changed file with 7 additions and 24 deletions.
31 changes: 7 additions & 24 deletions .github/workflows/check_properties.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ on:
paths:
- "src/main/resources/messages_*.properties"
push:
branches: ["main"]
paths:
- "src/main/resources/messages_en_GB.properties"

# Permissions required for the workflow
permissions:
contents: write
pull-requests: write

jobs:
check-files:
if: github.event_name == 'pull_request_target'
Expand Down Expand Up @@ -90,7 +86,7 @@ jobs:
--actor ${{ github.event.pull_request.user.login }} \
--reference-file "${REFERENCE_FILE}" \
--branch "${BRANCH_PATH}" \
--files ${CHANGED_FILES} > failure.txt || true
--files "${CHANGED_FILES[@]}" > failure.txt || true
- name: Capture output
id: capture-output
Expand Down Expand Up @@ -150,26 +146,11 @@ jobs:
console.log("Comment update attempt denied. Actor does not match.");
}
# - name: Set up git config
# run: |
# git config --global user.name "github-actions[bot]"
# git config --global user.email "github-actions[bot]@users.noreply.github.com"

# - name: Add translation keys
# run: |
# cd ${{ env.BRANCH_PATH }}
# git add src/main/resources/messages_*.properties
# git diff --staged --quiet || echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
# git commit -m "Update translation files" || echo "No changes to commit"
# - name: Push
# if: env.CHANGES_DETECTED == 'true'
# run: |
# cd pr-branch
# git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.event.pull_request.head.repo.full_name }}.git
# git push origin ${{ github.head_ref }} || echo "Push failed: possibly no changes to push"

update-translations-main:
if: github.event_name == 'push'
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -210,6 +191,8 @@ jobs:
signoff: true
branch: update_translation_files
title: "Update translation files"
add-paths: |
src/main/resources/messages_*.properties
body: |
Auto-generated by [create-pull-request][1]
Expand Down

0 comments on commit 32d575b

Please sign in to comment.