|
9 | 9 | create_pr:
|
10 | 10 | runs-on: ubuntu-latest
|
11 | 11 | steps:
|
12 |
| - - uses: actions/checkout@master |
13 |
| - - uses: actions/setup-node@v3 |
| 12 | + - name: Check out code |
| 13 | + uses: actions/checkout@master |
| 14 | + |
| 15 | + - name: Set up Node.js |
| 16 | + uses: actions/setup-node@v3 |
14 | 17 | with:
|
15 | 18 | node-version: 18
|
16 |
| - - run: yarn install |
17 |
| - - run: yarn events-import |
| 19 | + |
| 20 | + - name: Install dependencies |
| 21 | + run: yarn install |
| 22 | + |
| 23 | + - name: Set up git |
| 24 | + run: | |
| 25 | + git config --global user.email "[email protected]" |
| 26 | + git config --global user.name "GitHub Action" |
| 27 | +
|
| 28 | + - name: Generate timestamp and readable date |
| 29 | + id: date |
| 30 | + run: | |
| 31 | + echo "TIMESTAMP=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV |
| 32 | + echo "READABLE_DATE=$(date +'%B %-d')" >> $GITHUB_ENV |
| 33 | +
|
| 34 | + - name: Fetch latest dev and create new branch |
| 35 | + run: | |
| 36 | + git fetch origin dev |
| 37 | + git checkout -b "automated-update-${{ env.TIMESTAMP }}" origin/dev |
| 38 | +
|
| 39 | + - name: Run script |
| 40 | + run: yarn events-import |
18 | 41 | env:
|
19 | 42 | GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
20 |
| - - uses: EndBug/add-and-commit@v9 |
21 |
| - with: |
22 |
| - default_author: github_actions |
23 |
| - message: "Update community events" |
| 43 | + |
| 44 | + - name: Commit and push |
| 45 | + run: | |
| 46 | + git add -A |
| 47 | + git commit -m "Update community events" |
| 48 | + git push origin "automated-update-${{ env.TIMESTAMP }}" |
| 49 | +
|
| 50 | + - name: Create PR body |
| 51 | + run: | |
| 52 | + echo "This PR was automatically created to update community events from external community spreadsheet." > pr_body.txt |
| 53 | + echo "This workflows runs every Sunday at 00:00 (UTC)." >> pr_body.txt |
| 54 | + echo "Source: https://docs.google.com/spreadsheets/d/1NEu_FCc1hnGAuRgPmbXXpf0h2lCrCOlMKbbFEqgkVDQ" >> pr_body.txt |
| 55 | +
|
| 56 | + - name: Create Pull Request |
| 57 | + run: | |
| 58 | + gh auth login --with-token ${{ secrets.GITHUB_TOKEN }} |
| 59 | + gh pr create --base dev --head "automated-update-${{ env.TIMESTAMP }}" --title "Update community events from external spreadsheet - ${{ env.READABLE_DATE }}" --body-file pr_body.txt |
0 commit comments