-
Notifications
You must be signed in to change notification settings - Fork 5
69 lines (65 loc) · 2.38 KB
/
update-lexicon.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Update Lexicons
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- uses: swift-actions/setup-swift@v1
with:
swift-version: 5.9
- uses: actions/checkout@v3
with:
ref: main
submodules: true
- name: Configure git
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Switch to new branch
id: switch-branch
run: |
BRANCH_NAME="update-lexicon/$(date "+%Y-%m-%d-%H-%M-%S")"
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
git switch -c $BRANCH_NAME
- name: Update submodule
run: git submodule update --remote --recursive atproto
- name: Commit updates of submodule
id: commit-submodule
run: |
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Update bluesky-social/atproto to $(git submodule status atproto | awk '{ print $1 }') at $(date "+DATE: %Y-%m-%d TIME: %H:%M:%S")"
echo "commit=true" >> $GITHUB_OUTPUT
fi
- uses: actions/cache@v3
id: tools-cache
with:
path: Tools/.build
key: ${{ runner.os }}-spm-tools-${{ hashFiles('**/Tools/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-tools-
- name: Build tools
if: steps.tools-cache.outputs.cache-hit != 'true'
run: make build-tools
- name: Generate
run: make lexicon-gen
- name: Commit updates of generated files
id: commit-generated
run: |
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Update submodules at $(date "+DATE: %Y-%m-%d TIME: %H:%M:%S")"
echo "commit=true" >> $GITHUB_OUTPUT
fi
- name: Create PR
if: ${{ steps.commit-submodule.outputs.commit == 'true' || steps.commit-generated.outputs.commit == 'true' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
git push origin ${{ steps.switch-branch.outputs.branch-name }}
TITLE="Update bluesky-social/atproto to $(git submodule status atproto | awk '{ print $1 }')"
gh pr create -B main -t "$TITLE" -b ""