This repository has been archived by the owner on Aug 11, 2023. It is now read-only.
Error in the console everytime saturday roles around and happens again upon reloading on that day #85
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Issue Check | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
issue-check: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- uses: actions/checkout@v2 | |
# Read the contents of the template-bug-report.md file | |
- name: Read ISSUE_TEMPLATE.md | |
run: | | |
ISSUE_TEMPLATE=$(cat .github/ISSUE_TEMPLATE/template-bug-report.md) | |
# Read the contents of the newly submitted issue, removing the title | |
- name: Read issue | |
run: | | |
ISSUE=$(cat $GITHUB_EVENT_PATH | sed -n '3,$p') | |
# Compare the contents of the template-bug-report.md and the newly submitted issue | |
- name: Compare issues | |
run: | | |
if [ "$ISSUE_TEMPLATE" == "$ISSUE" ]; then | |
echo "The issue ${{ github.event.issue.number }} matches the template-bug-report.md" | |
# Set a variable indicating that the issue should be closed | |
CLOSE_ISSUE=true | |
else | |
echo "The issue does not match the template-bug-report.md" | |
exit 1 | |
fi | |
# If the issue should be closed, close it with the "invalid" tag and post a comment | |
- if: ${{ env.CLOSE_ISSUE }} | |
uses: octokit/[email protected] | |
with: | |
route: POST /repos/:owner/:repo/issues/:issue_number/comments | |
data: '{"body": "Closed automatically, due to issue being a template."}' | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
# If the issue should be closed, close it with the "invalid" tag | |
- if: ${{ env.CLOSE_ISSUE }} | |
uses: octokit/[email protected] | |
with: | |
route: PATCH /repos/:owner/:repo/issues/:issue_number | |
data: '{"state": "closed", "labels": ["invalid"]}' | |
repo_token: ${{ secrets.GITHUB_TOKEN }} |