Skip to content

Adjustments for docs upload action #18

Adjustments for docs upload action

Adjustments for docs upload action #18

Workflow file for this run

name: GitHub Actions linter
on:
pull_request:
workflow_call:
permissions: { }
jobs:
actionlint:
name: actionlint
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
pull-requests: read
env:
ACTIONLINT_MATCHER_PATH: .github/workflows/actionlint-matcher.json
steps:
- name: Detect workflow changes
id: change-detector
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
set -e # Fail if the gh command fails (e.g. can't connect, ...)
# JQ checks if ANY file path starts with our target directory, returning a literal "true" or "false"
IS_CHANGED=$(gh pr view "$PR_NUMBER" --repo "$REPO" --json files --jq 'any(.files[]; .path | startswith(".github/workflows/"))')
# Output the result directly to GitHub Actions
echo "any_workflow_changed=$IS_CHANGED" >> "$GITHUB_OUTPUT"
echo 'Running actionlint; see here for config (actionlint.yml, ...): https://github.com/hibernate/.github/blob/main/.github/workflows/actionlint.yml'
- name: Shallow check out repository code
if: steps.change-detector.outputs.any_workflow_changed == 'true'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
# https://github.com/rhysd/actionlint/blob/main/docs/config.md
- name: Set up actionlint.yml
if: steps.change-detector.outputs.any_workflow_changed == 'true'
run: |
# We override any repository config, so that PRs cannot change it.
rm -f '.github/actionlint.yml' '.github/actionlint.yaml'
cat << 'EOF' > '.github/actionlint.yml'
self-hosted-runner:
# Labels of self-hosted runner in array of strings.
labels:
- OracleTestPilot
EOF
# https://github.com/rhysd/actionlint/blob/main/docs/usage.md#problem-matchers
# https://raw.githubusercontent.com/rhysd/actionlint/main/.github/actionlint-matcher.json
- name: Set up actionlint matcher
if: steps.change-detector.outputs.any_workflow_changed == 'true'
run: |
[[ -f "$ACTIONLINT_MATCHER_PATH" ]] && exit 0
cat << 'EOF' > "$ACTIONLINT_MATCHER_PATH"
{
"problemMatcher": [
{
"owner": "actionlint",
"pattern": [
{
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
"code": 5
}
]
}
]
}
EOF
# https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions
- name: Download and run actionlint
if: steps.change-detector.outputs.any_workflow_changed == 'true'
run: |
echo "::add-matcher::$ACTIONLINT_MATCHER_PATH"
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color