forked from babel/babel
-
-
Notifications
You must be signed in to change notification settings - Fork 4
75 lines (65 loc) · 2.32 KB
/
update-windows-fixtures.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
70
71
72
73
74
75
name: Update Windows Fixtures
on:
workflow_dispatch:
inputs:
pull_request:
description: Pull Request number
required: true
permissions:
contents: read
jobs:
update-windows-fixtures:
permissions:
contents: read # to fetch code
pull-requests: read # to get PR metadata
runs-on: windows-latest
steps:
- name: Get Pull Request branch
uses: actions/github-script@v6
id: pr-meta
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pullRequest } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ github.event.inputs.pull_request }},
});
const {
ref: branch,
repo: { full_name: repository }
} = pullRequest.head;
const fs = require("fs");
const { GITHUB_OUTPUT } = process.env;
fs.appendFileSync(GITHUB_OUTPUT, `branch=${branch}\n`);
fs.appendFileSync(GITHUB_OUTPUT, `repository=${repository}\n`);
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ steps.pr-meta.outputs.repository }}
ref: ${{ steps.pr-meta.outputs.branch }}
fetch-depth: 0 # Otherwise we cannot push
persist-credentials: false # So that we can push with BOT_TOKEN, otherwise it doesn't trigger CI
- name: Use Node.js latest
uses: actions/setup-node@v4
with:
node-version: 22
cache: "yarn"
- name: Install and build
# make bootstrap modifies some files (babel-runtime-*/package.json), so we reset them
run: |
make -j bootstrap
git reset --hard HEAD
- name: Regenerate fixtures
run: |
yarn jest -u --ci || true
env:
BABEL_ENV: test
OVERWRITE: true
- name: Commit updates
run: |
git config user.name "Babel Bot"
git config user.email "babel-bot@users.noreply.github.com"
git add .
git commit -m "Update fixtures (Windows)" --no-verify --quiet
git push "https://babel-bot:${{ secrets.BOT_TOKEN }}@github.com/${{ steps.pr-meta.outputs.repository }}.git" ${{ steps.pr-meta.outputs.branch }}