File tree Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Original file line number Diff line number Diff line change 1212
1313 outputs :
1414 is_fork : ${{ steps.context.outputs.is_fork }}
15+ is_default_branch : ${{ steps.context.outputs.is_default_branch }}
1516
1617 steps :
1718 - uses : actions/checkout@v5
2728 fetch-depth : 0
2829 ref : ${{ github.event.pull_request.head.ref }}
2930 repository : ${{ github.event.pull_request.head.repo.full_name }}
30- persist-credentials : false
31+ persist-credentials : ${{ needs.context.outputs.is_default_branch }}
3132
3233 - uses : actions/setup-node@v5
3334 with :
4748 run : |
4849 event_name="${{ github.event_name }}"
4950 is_fork="${{ needs.context.outputs.is_fork }}"
51+ is_default_branch="${{ needs.context.outputs.is_default_branch }}"
52+ is_push="${{ github.event_name == 'push' }}"
53+
54+ # Keep this logic in sync with addons-server
5055
5156 if [[ "$is_fork" == 'true' ]]; then
5257 cat <<'EOF'
@@ -57,13 +62,10 @@ jobs:
5762 exit 0
5863 fi
5964
60- ARGS=""
61-
62- if [[ "$event_name" == 'pull_request' ]]; then
63- ARGS ="--dry-run"
65+ if [[ "$is_default_branch" == 'true' && "$is_push" == 'true' ]]; then
66+ args=""
67+ else
68+ args ="--dry-run"
6469 fi
6570
66- ./bin/push-locales $ARGS
67-
68-
69-
71+ ./bin/push-locales $args
Original file line number Diff line number Diff line change @@ -51,10 +51,20 @@ GIT_AUTHOR_EMAIL: $GIT_AUTHOR_EMAIL
5151GIT_COMMITTER_NAME: $GIT_COMMITTER_NAME
5252GIT_COMMITTER_EMAIL: $GIT_COMMITTER_EMAIL
5353
54- This script passes arguments directly to Git commands. We can pass --dry-mode to test this script
55- Without actually committing or pushing. Make sure to only pass arguments supported on both commit and push..
54+ This script passes arguments directly to Git commands. We can pass --dry-mode to test this script.
55+ Without actually committing or pushing. Make sure to only pass arguments supported on both commit
56+ and push.
57+
5658ARGS: $@
5759" " "
5860
5961git commit -am " $MESSAGE " " $@ "
62+
63+ if [[ " $@ " =~ ' --dry-run' ]]; then
64+ info " " "
65+ Skipping 'git push' because '--dry-run' is in ARGS and we do not have git credentials.
66+ " " "
67+ exit 0
68+ fi
69+
6070git push " $@ "
You can’t perform that action at this time.
0 commit comments