Skip to content

Conversation

@reybahl
Copy link
Member

@reybahl reybahl commented Jan 10, 2026

No description provided.

Comment on lines +18 to +80
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v4

- uses: actions/checkout@v4
with:
repository: coursetable/ferry-data
path: data
ssh-key: ${{ secrets.REPO_SSH_KEY }}
fetch-depth: 1

- name: Install Packages
run: |
sudo apt-get update
sudo apt-get -y install gcc g++ musl-dev libffi-dev libpq-dev libhdf5-dev python3-tables graphviz libgraphviz-dev

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Install uv and create virtual environment
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH

- name: Install dependencies
run: uv pip install -e .

- name: Fetch with Locations
run: |
SEASON_ARG=""
if [ -n "${{ github.event.inputs.seasons }}" ]; then
SEASON_ARG="--seasons ${{ github.event.inputs.seasons }}"
fi
TQDM_DISABLE=1 python -u main.py -f config/release_fetch.yml \
--database-connect-string "${{ secrets.DATABASE_CONNECT_STRING }}" \
--sentry-url "${{ secrets.SENTRY_URL }}" \
--cws-api-key "${{ secrets.CWS_API_KEY }}" \
--ycs-cookie "${{ github.event.inputs.ycs_cookie }}" \
--ycs-pers "${{ github.event.inputs.ycs_pers }}" \
$SEASON_ARG

- name: Sync Postgres DB
run: TQDM_DISABLE=1 python -u main.py -f config/release_sync_db_courses.yml --database-connect-string ${{ secrets.DATABASE_CONNECT_STRING }} --sentry-url ${{ secrets.SENTRY_URL }}

- name: Commit updated ferry-data
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Manual Location Sync by ${{ github.actor }}"
commit_user_name: "Ferry Bot"
commit_user_email: "[email protected]"
commit_author: course-table <[email protected]>
repository: data
skip_dirty_check: false

- name: Regenerate static catalog on server
run: |
curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" https://api.coursetable.com/api/catalog/refresh
curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" https://api-staging.coursetable.com/api/catalog/refresh

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 18 hours ago

To fix this, we should explicitly define the minimal GITHUB_TOKEN permissions required for this workflow. The job needs to be able to commit and push changes to the data repository via the git-auto-commit-action, which uses GITHUB_TOKEN by default unless configured otherwise, so it requires contents: write. There is no evidence of needing other GitHub API write scopes (issues, pull-requests, etc.), and reading repository contents is implied by contents: write. The cleanest, non-functional change is to add a permissions block at the workflow root so it applies to all jobs.

Concretely:

  • In .github/workflows/ferry-locations.yml, add a top-level permissions: section (aligned with on: and jobs:) specifying contents: write. This satisfies the CodeQL requirement (explicit permissions) and enforces least-privilege for the visible operations.
  • No imports or additional methods are needed because this is YAML configuration only.
  • No steps or behavior of the workflow need to change; we are only constraining token permissions.
Suggested changeset 1
.github/workflows/ferry-locations.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/ferry-locations.yml b/.github/workflows/ferry-locations.yml
--- a/.github/workflows/ferry-locations.yml
+++ b/.github/workflows/ferry-locations.yml
@@ -13,6 +13,9 @@
         required: false
         default: ""
 
+permissions:
+  contents: write
+
 jobs:
   ferry:
     runs-on: ubuntu-latest
EOF
@@ -13,6 +13,9 @@
required: false
default: ""

permissions:
contents: write

jobs:
ferry:
runs-on: ubuntu-latest
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants