Describe the bug
The apm-packages-update.yml workflow template grants write
permissions to the automatic GITHUB_TOKEN, has no concurrency control, and
does not set a job timeout.
The template passes APM_UPDATE_TOKEN to checkout and to
apm-packages-update. The action uses that explicit input token to create or
update its pull request and the fixed chore/update-apm-packages branch.
Therefore, the job-level GITHUB_TOKEN does not need contents: write or
pull-requests: write.
Without concurrency, a scheduled run and a manual run can update the same
branch and pull request concurrently. Without timeout-minutes, a stuck
maintenance job can consume a runner for the default six-hour limit.
To Reproduce
- Open the APM package update workflow template.
- Inspect the
test-apm-update job:
permissions grants contents: write and pull-requests: write;
- the job has no
timeout-minutes;
- the workflow has no
concurrency block.
- Trigger two runs of a workflow generated from this template, for example a
scheduled run and workflow_dispatch.
- Both runs invoke
apm-packages-update, which uses the fixed
chore/update-apm-packages branch.
Version
- Template:
Netcracker/.github/workflow-templates/apm-packages-update.yml
- Related action:
netcracker/qubership-workflow-hub/actions/apm-packages-update
- Related action issue:
qubership-workflow-hub#949
Logs
Not applicable. The problem is visible in the template configuration before a
workflow run starts.
Additional information
Update the template as follows:
-
Set job-level permissions to contents: read only. The action receives its
write-capable APM_UPDATE_TOKEN explicitly.
-
Add a single-flight concurrency group, for example:
concurrency:
group: apm-packages-update-${{ github.repository }}
cancel-in-progress: false
-
Add timeout-minutes: 20 to the test-apm-update job.
The action-version compatibility problem is tracked separately in
qubership-workflow-hub#949.
Describe the bug
The
apm-packages-update.ymlworkflow template grants writepermissions to the automatic
GITHUB_TOKEN, has no concurrency control, anddoes not set a job timeout.
The template passes
APM_UPDATE_TOKENto checkout and toapm-packages-update. The action uses that explicit input token to create orupdate its pull request and the fixed
chore/update-apm-packagesbranch.Therefore, the job-level
GITHUB_TOKENdoes not needcontents: writeorpull-requests: write.Without
concurrency, a scheduled run and a manual run can update the samebranch and pull request concurrently. Without
timeout-minutes, a stuckmaintenance job can consume a runner for the default six-hour limit.
To Reproduce
test-apm-updatejob:permissionsgrantscontents: writeandpull-requests: write;timeout-minutes;concurrencyblock.scheduled run and
workflow_dispatch.apm-packages-update, which uses the fixedchore/update-apm-packagesbranch.Version
Netcracker/.github/workflow-templates/apm-packages-update.ymlnetcracker/qubership-workflow-hub/actions/apm-packages-updatequbership-workflow-hub#949
Logs
Not applicable. The problem is visible in the template configuration before a
workflow run starts.
Additional information
Update the template as follows:
Set job-level permissions to
contents: readonly. The action receives itswrite-capable
APM_UPDATE_TOKENexplicitly.Add a single-flight concurrency group, for example:
Add
timeout-minutes: 20to thetest-apm-updatejob.The action-version compatibility problem is tracked separately in
qubership-workflow-hub#949.