Skip to content

Update revisions and PRs #70304

Update revisions and PRs

Update revisions and PRs #70304

Workflow file for this run

name: Update revisions and PRs
on:
schedule:
# Every 30 minutes
- cron: '*/30 * * * *'
push:
branch: master
jobs:
build:
runs-on: ubuntu-latest
concurrency: build
steps:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: "3.7"
# ==== Bootstrap for history update ====
- name: Get gh-pages hash
run: |
curl \
--url https://api.github.com/repos/${{ github.repository }}/branches/gh-pages \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' | \
python -c 'import sys; import json; print("##[set-output name=sha;]{}".format(json.loads(sys.stdin.read())["commit"]["sha"]))'
id: pages_hash
- name: Download gh-pages Bootstrap
run: |
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/Makefile
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/build.py
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/config.json
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/broken_revs.json
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/history/revs.json
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/history/prs.json
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/requirements.txt
mkdir -p history
mv revs.json history
mv prs.json history
- name: Setup virtualenv
run: make py-venv-bootstrap
- name: Run gh-pages Bootstrap
run: make bootstrap
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
id: pages_bootstrap
- name: Remove gh-pages Bootstrap
run: |
rm Makefile
rm build.py
rm config.json
rm broken_revs.json
rm -rf history
rm requirements.txt
# ==== Bootstrap for posting PR status ====
#- name: Get pr-status hash
# run: |
# curl \
# --url https://api.github.com/repos/${{ github.repository }}/branches/pr-status \
# --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
# --header 'content-type: application/json' | \
# python -c 'import sys; import json; print("##[set-output name=sha;]{}".format(json.loads(sys.stdin.read())["commit"]["sha"]))'
# id: status_hash
#- name: Download pr-status Bootstrap
# run: |
# curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.status_hash.outputs.sha}}/Makefile
# curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.status_hash.outputs.sha}}/build.py
# curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.status_hash.outputs.sha}}/config.json
# curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.status_hash.outputs.sha}}/pr-status.json
#- name: Run pr-status Bootstrap
# run: make bootstrap
# id: status_bootstrap
#- name: Remove pr-status Bootstrap
# run: |
# rm Makefile
# rm build.py
# rm config.json
# rm pr-status.json
# ==== Checkout if history or PR status needs to be updated ====
- name: Checkout
#if: steps.pages_bootstrap.outputs.update == 'Yes' || steps.status_bootstrap.outputs.update == 'Yes'
if: steps.pages_bootstrap.outputs.update == 'Yes'
uses: actions/checkout@v1
with:
ref: gh-pages
- name: Set Git Profile
#if: steps.pages_bootstrap.outputs.update == 'Yes' || steps.status_bootstrap.outputs.update == 'Yes'
if: steps.pages_bootstrap.outputs.update == 'Yes'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Setup virtualenv
#if: steps.pages_bootstrap.outputs.update == 'Yes' || steps.status_bootstrap.outputs.update == 'Yes'
if: steps.pages_bootstrap.outputs.update == 'Yes'
run: make py-venv
# ==== Post PR status for previous update ====
#- name: Checkout pr-status
# if: steps.status_bootstrap.outputs.update == 'Yes'
# run: |
# git checkout pr-status
#### disable for now
#- name: Post PR status
# if: steps.status_bootstrap.outputs.update == 'Yes'
# run: make post
# env:
# POST_TOKEN: ${{secrets.POST_TOKEN}}
#- name: Commit PR status JSON
# if: steps.status_bootstrap.outputs.update == 'Yes'
# run: |
# git add pr-status.json
# set +e
# git diff --cached --quiet
# echo "##[set-output name=modified;]$?"
# set -e
# id: status_post
#- name: Commit PR status JSON
# if: steps.status_post.outputs.modified == '1'
# run: |
# git commit -m "Post PR status"
#- name: Push PR status JSON changes
# if: steps.status_post.outputs.modified == '1'
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: pr-status
# force: false
#- name: Checkout gh-pages
# if: steps.status_bootstrap.outputs.update == 'Yes'
# run: |
# git checkout gh-pages
# ==== Update history ====
- name: Clone ecma262
if: steps.pages_bootstrap.outputs.update == 'Yes'
run: make clone
- name: Update revisions
if: steps.pages_bootstrap.outputs.update_revs == 'Yes'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: make update5
- name: Update PRs
if: steps.pages_bootstrap.outputs.update_prs == 'Yes'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: make pr5
id: prs
- name: Add history
if: steps.pages_bootstrap.outputs.update == 'Yes'
run: |
git add history
git add broken_revs.json
set +e
git diff --cached --quiet
echo "##[set-output name=modified;]$?"
set -e
id: pages_add
- name: Commit history
if: steps.pages_add.outputs.modified == '1'
run: |
git commit -m "update history"
- name: Push history changes
if: steps.pages_add.outputs.modified == '1'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
force: false
# ==== Store PR status data for the next run ====
- name: Checkout pr-status
if: steps.prs.outputs.updated_pr_list != ''
run: |
git checkout pr-status
- name: Store PR status data
if: steps.prs.outputs.updated_pr_list != ''
run: make store
env:
UPDATED_PR_LIST: ${{ steps.prs.outputs.updated_pr_list }}
POST_TOKEN: ${{secrets.POST_TOKEN}}
- name: Add PR status JSON
if: steps.prs.outputs.updated_pr_list != ''
run: |
git add pr-status.json
set +e
git diff --cached --quiet
echo "##[set-output name=modified;]$?"
set -e
id: status_add
- name: Commit PR status JSON
if: steps.status_add.outputs.modified == '1'
run: |
git commit -m "Store PR status"
- name: Push PR status JSON changes
if: steps.status_add.outputs.modified == '1'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: pr-status
force: false