Skip to content

chore: pin GitHub Actions uses: references to commit SHA instead of tag #1206

chore: pin GitHub Actions uses: references to commit SHA instead of tag

chore: pin GitHub Actions uses: references to commit SHA instead of tag #1206

Workflow file for this run

--- # PR: update pull request metadata
# Maintain in repo: funfair-server-template
name: "PR: Update"
on:
pull_request:
types:
- opened
- reopened
- synchronize
branches:
- main
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: false
permissions:
contents: read
env:
HEAD_REF: ${{github.head_ref}}
BASE_REF: ${{github.base_ref}}
jobs:
requirements:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: "Check Required Secrets"
shell: bash
run: |
if [ -z "${{secrets.SOURCE_PUSH_TOKEN}}" ]; then
echo "::error::SOURCE_PUSH_TOKEN is required but not set"
exit 1
fi
info:
if: endsWith(github.repository , '-template')
runs-on: ubuntu-latest
steps:
- name: "Initialise Workspace"
if: runner.environment == 'self-hosted'
shell: bash
run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE"
- name: "Set Active Environment"
shell: bash
run: |
{
echo "ACTIVE_RUNNER_NAME=${{runner.name}}"
echo "ACTIVE_HOSTNAME=$HOSTNAME"
echo "ACTIVE_USER=$USER"
} >> "$GITHUB_ENV"
- name: "Info"
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
core.info(`Branch: ${process.env.HEAD_REF}`);
core.info(`Base Branch: ${process.env.BASE_REF}`);
core.info(`Repo: ${context.repo.owner}/${context.repo.repo}`);
core.info(`Owner: ${context.repo.owner}`);
core.info(`Assigned: ${context.payload.pull_request?.assignee?.login}`);
core.info(`Assigned: ${context.payload.pull_request?.assignees?.[0]?.login}`);
core.info(`Last Modified By: ${context.payload.pull_request?.head?.user?.login}`);
core.info(`PR Creator: ${context.payload.pull_request?.user?.login}`);
core.info(`PR Owner: ${context.payload.pull_request?.user?.login}`);
core.info(`Actor: ${context.actor}`);
await core.summary
.addHeading('Info')
.addTable([
[{data: 'Property', header: true}, {data: 'Value', header: true}],
['Branch', `${process.env.HEAD_REF}`],
['Base Branch', `${process.env.BASE_REF}`],
['Repo', `${context.repo.owner}/${context.repo.repo}`],
['Owner', `${context.repo.owner}`],
['Assignee', `${context.payload.pull_request?.assignee?.login}`],
['Assignee (0)', `${context.payload.pull_request?.assignees?.[0]?.login}`],
['Last Modified By', `${context.payload.pull_request?.head?.user?.login}`],
['PR Creator', `${context.payload.pull_request?.user?.login}`],
['PR Owner', `${context.payload.pull_request?.user?.login}`],
['Actor', `${context.actor}`],
])
.write();
add-pr-label:
needs: [requirements]
if: ${{github.actor != 'dependabot[bot]'}}
runs-on: ubuntu-latest
steps:
- name: "Initialise Workspace"
if: runner.environment == 'self-hosted'
shell: bash
run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE"
- name: "Set Active Environment"
shell: bash
run: |
{
echo "ACTIVE_RUNNER_NAME=${{runner.name}}"
echo "ACTIVE_HOSTNAME=$HOSTNAME"
echo "ACTIVE_USER=$USER"
} >> "$GITHUB_ENV"
- name: "Checkout Source"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
clean: true
fetch-depth: 1
- name: "Add Labels"
uses: ./.github/actions/sync-labels
with:
github-token: ${{secrets.SOURCE_PUSH_TOKEN}}
pr-number: ${{github.event.pull_request.number}}
assign-to-creator:
needs: [requirements]
if: |-
!github.event.pull_request.assignee.login
&& github.event_name == 'pull_request'
&& ( github.event.action == 'opened' || github.event.action == 'reopened')
&& github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: "Initialise Workspace"
if: runner.environment == 'self-hosted'
shell: bash
run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE"
- name: "Set Active Environment"
shell: bash
run: |
{
echo "ACTIVE_RUNNER_NAME=${{runner.name}}"
echo "ACTIVE_HOSTNAME=$HOSTNAME"
echo "ACTIVE_USER=$USER"
} >> "$GITHUB_ENV"
- name: "Checkout Source"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
clean: true
fetch-depth: 1
- name: "Assign PR to the creator"
uses: ./.github/actions/assign-pr-to-creator
with:
github-token: ${{secrets.SOURCE_PUSH_TOKEN}}