add: logging capabilities + log-level flag #36
This file contains hidden or 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: sha-checker | |
| on: | |
| pull_request: | |
| types: [labeled, unlabeled, opened, reopened, synchronize] | |
| workflow_dispatch: | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Check if files included in appropriately labeled PRs | |
| run: | | |
| # Get PR number | |
| PR_NO=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") | |
| echo "PR number: $PR_NO" | |
| # Get PR labels | |
| labels="$(gh api repos/${DOWNSTREAM}/pulls/$PR_NO --jq '.labels.[].name')" | |
| echo "$labels" | |
| # Check for exclusive label to continue operations | |
| if [[ $labels =~ (EXCLUSIVE LABEL) ]]; then | |
| echo "Label found. Continuing..." | |
| else | |
| echo "Label not found. No sha-checker needed." | |
| exit 0 | |
| fi | |
| # Get changed files | |
| files="$(gh pr view "$PR_NO" --json files -q '.files[].path')" | |
| echo "$files" | |
| # Check if '.lastcommsha' among changed files | |
| if [[ $files =~ (.lastcommsha) ]]; then | |
| echo "File found." | |
| exit 0 | |
| else | |
| echo "File not found. Please make sure you update the sha within '.lastcommsha'." | |
| exit 1 | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| UPSTREAM: "tock/tock" | |
| DOWNSTREAM: "WyliodrinEmbeddedIoT/tockloader-rs" | |