Skip to content

Commit 964e675

Browse files
authored
Merge pull request #20916 from emberjs/kg-update-cron
2 parents fe156dd + f3ff312 commit 964e675

File tree

1 file changed

+12
-42
lines changed

1 file changed

+12
-42
lines changed

.github/workflows/cron.yml

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,54 +11,24 @@ permissions:
1111
jobs:
1212
trigger-ci:
1313
permissions:
14-
contents: read # the push uses a non-default token so it will trigger workflows
14+
contents: read # the push uses a personal-access token so it will trigger workflows, so this permission is read-only
1515
checks: read
1616

1717
name: Trigger cron build
1818
runs-on: ubuntu-latest
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
branch:
23-
- main
24-
- beta
25-
- release
22+
branch: [main, beta, release]
2623
steps:
27-
- uses: actions/checkout@v4
24+
- uses: kategengler/ci-cron@v1
2825
with:
29-
persist-credentials: false
30-
fetch-depth: 0
31-
ref: ${{matrix.branch}}
32-
33-
- name: Make a commit to have a unique sha
34-
run: |
35-
touch cron.txt
36-
git config --local user.email '[email protected]'
37-
git config --local user.name 'Ember.js Cron CI'
38-
git add cron.txt
39-
git commit -m "Cron $(date +%Y-%m-%d) for ${{matrix.branch}}"
40-
export SHA=`git rev-parse HEAD`
41-
echo "SHA=$SHA" >> $GITHUB_ENV
42-
43-
- name: Push branch to trigger Build workflow
44-
# This must use a personal access token because of a Github Actions
45-
# limitation where it will not trigger workflows from pushes from
46-
# other workflows with the token it provides.
47-
# The PERSONAL_ACCESS secret must be a token with `repo` scope.
48-
# See https://help.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token
49-
run: |
50-
git checkout -B cron-${{matrix.branch}}-${{env.SHA}}
51-
git push https://${GITHUB_ACTOR}:${{ secrets.PERSONAL_TOKEN }}@github.com/${GITHUB_REPOSITORY} cron-${{matrix.branch}}-${{env.SHA}} --force
52-
53-
- name: Wait for Build completion
54-
uses: jitterbit/await-check-suites@v1
55-
with:
56-
ref: ${{ env.SHA }}
57-
appSlugFilter: github-actions
58-
onlyFirstCheckSuite: true
59-
timeoutSeconds: 1800
60-
61-
- name: Cleanup
62-
# Always cleanup the cron-* branches
63-
if: always()
64-
run: git push https://${GITHUB_ACTOR}:${{ secrets.PERSONAL_TOKEN}}@github.com/${GITHUB_REPOSITORY} --delete cron-${{matrix.branch}}-${{env.SHA}} || true # Don't fail build if cleanup fails
26+
branch: ${{ matrix.branch }}
27+
# This must use a personal access token because of a Github Actions
28+
# limitation where it will not trigger workflows from pushes from
29+
# other workflows with the token it provides.
30+
# The PERSONAL_ACCESS secret must be a token with `repo` scope.
31+
# See https://help.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token
32+
personal_token: ${{ secrets.PERSONAL_TOKEN }}
33+
committer_email: '[email protected]'
34+
committer_name: 'Ember.js Cron CI'

0 commit comments

Comments
 (0)