Skip to content

Add stale PR direction #529

Add stale PR direction

Add stale PR direction #529

# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: RWS submission checks
on:
schedule:
- cron: '0 14 * * 2' # 2pm UTC each Tuesday
pull_request_target:
jobs:
PR-Actions:
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.read_results.outputs.contents }}
steps:
- name: Get the PR version of the files
uses: actions/checkout@v2
with:
ref: "refs/pull/${{ github.event.number }}/merge"
path: "pull-request"
- name: Get the version at main
uses: actions/checkout@v2
with:
path: "main"
- name: Get necessary libraries
run: pip install publicsuffix2
- name: Content check
id: check
run: python3 main/check_sites.py -i pull-request/related_website_sets.JSON --data_directory=main --with_diff > results.txt
- name: Read the result
id: read_results
uses: andstor/file-reader-action@v1
with:
path: "results.txt"
- name: File contents
env:
CONTENTS: ${{ steps.read_results.outputs.contents }}
run: echo "$CONTENTS"
- name: Create Comment
if: steps.read_results.outputs.contents != 'success'
run: |
echo "It appears you have failed some tests. Here are your results:" > message.txt
cat results.txt >> message.txt
- name: Comment if sucess
if: steps.read_results.outputs.contents == 'success'
run: echo "Looks like you've passed all of the checks!" >> message.txt
- name: Write Comment on PR
uses: mshick/add-pr-comment@v2
with:
message-path: "message.txt"
refresh-message-position: true
- name: Fail or Succeed
if: steps.read_results.outputs.contents != 'success'
uses: actions/github-script@v3
with:
script: |
core.setFailed('This run has failed. Check `File Contents` to see why.')