55 - cron : ' 0 9 * * *' # Runs daily at 9AM UTC
66 workflow_dispatch :
77
8+ permissions : {}
9+
810jobs :
911 check-pr-exists :
1012 runs-on : ubuntu-latest
13+ permissions :
14+ pull-requests : read
1115 outputs :
1216 pr_exists : ${{ steps.check_pr_exists.outputs.pr_exists }}
1317 steps :
@@ -16,15 +20,15 @@ jobs:
1620 env :
1721 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
1822 run : |
19- PR_EXISTS=$(gh pr --repo $GITHUB_REPOSITORY \
23+ PR_EXISTS=$(gh pr --repo " $GITHUB_REPOSITORY" \
2024 list --search "Update tzdata to version" \
2125 --json number --jq '.[] | .number')
2226 if [ -n "$PR_EXISTS" ]; then
2327 echo "A PR updating the tzdata version already exists: https://github.com/python/tzdata/pulls/${PR_EXISTS}"
24- echo "pr_exists=true" >> $GITHUB_OUTPUT
28+ echo "pr_exists=true" >> " $GITHUB_OUTPUT"
2529 exit 0
2630 else
27- echo "pr_exists=false" >> $GITHUB_OUTPUT
31+ echo "pr_exists=false" >> " $GITHUB_OUTPUT"
2832 fi
2933
3034 check-for-updates :
3943 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4044 with :
4145 fetch-depth : 1 # Shallow clone to save time
46+ persist-credentials : true # Needed to push the update
4247
4348 - name : Set up Python 3.12
4449 uses : actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
6267 # Check for changes
6368 if git diff --quiet; then
6469 echo "No changes detected."
65- echo "CHANGES_DETECTED=false" >> $GITHUB_ENV
70+ echo "CHANGES_DETECTED=false" >> " $GITHUB_ENV"
6671 exit 0
6772 fi
6873
@@ -75,19 +80,19 @@ jobs:
7580 exit 1
7681 fi
7782
78- if [ $(echo "$news_files" | wc -l) -ne 1 ]; then
83+ if [ " $(echo "$news_files" | wc -l)" -ne 1 ]; then
7984 echo "More than one new file added in news.d, failing the job."
8085 exit 1
8186 fi
82- echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
87+ echo "CHANGES_DETECTED=true" >> " $GITHUB_ENV"
8388
8489 # Extract TZDATA_VERSION from filename
8590 TZDATA_VERSION=$(basename "$news_files" .md)
8691
8792 # Extract TZDATA_NEWS from file content
8893 TZDATA_NEWS=$(cat "$news_files")
8994
90- echo "TZDATA_VERSION=$TZDATA_VERSION" >> $GITHUB_ENV
95+ echo "TZDATA_VERSION=$TZDATA_VERSION" >> " $GITHUB_ENV"
9196 {
9297 echo "TZDATA_NEWS<<EOF"
9398 echo "$TZDATA_NEWS"
@@ -111,5 +116,5 @@ jobs:
111116 gh pr create --title "Update tzdata to version $TZDATA_VERSION" \
112117 --body "$TZDATA_NEWS" \
113118 --base master \
114- --head $(git rev-parse --abbrev-ref HEAD) \
119+ --head " $(git rev-parse --abbrev-ref HEAD)" \
115120 --label "automatic-updates"
0 commit comments