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 12
12
13
13
outputs :
14
14
is_fork : ${{ steps.context.outputs.is_fork }}
15
+ is_default_branch : ${{ steps.context.outputs.is_default_branch }}
15
16
16
17
steps :
17
18
- uses : actions/checkout@v5
27
28
fetch-depth : 0
28
29
ref : ${{ github.event.pull_request.head.ref }}
29
30
repository : ${{ github.event.pull_request.head.repo.full_name }}
30
- persist-credentials : false
31
+ persist-credentials : ${{ needs.context.outputs.is_default_branch }}
31
32
32
33
- uses : actions/setup-node@v5
33
34
with :
47
48
run : |
48
49
event_name="${{ github.event_name }}"
49
50
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
50
55
51
56
if [[ "$is_fork" == 'true' ]]; then
52
57
cat <<'EOF'
@@ -57,13 +62,10 @@ jobs:
57
62
exit 0
58
63
fi
59
64
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"
64
69
fi
65
70
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
51
51
GIT_COMMITTER_NAME: $GIT_COMMITTER_NAME
52
52
GIT_COMMITTER_EMAIL: $GIT_COMMITTER_EMAIL
53
53
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-run to test this script.
55
+ Without actually committing or pushing. Make sure to only pass arguments supported on both commit
56
+ and push.
57
+
56
58
ARGS: $@
57
59
" " "
58
60
59
61
git commit -am " $MESSAGE " " $@ "
62
+
63
+ if [[ " $@ " =~ ' --dry-run' ]]; then
64
+ info " " "
65
+ Skipping 'git push' because '--dry-run' is in ARGS so we should not have git credentials.
66
+ " " "
67
+ exit 0
68
+ fi
69
+
60
70
git push " $@ "
You can’t perform that action at this time.
0 commit comments