The use of bricks by World War I pilots is mentioned by a number of online sites. Unfortunately, none of them are sourced but some do provide plausible details, and one of the sites is the San Diego Air & Space Museum.
However, there does not appear to be any evidence that bricks were used because of a shortage of bombs. In fact, the main use of planes in the early stages of the war was for reconnaissance rather than dogfights. Some planes were also used for bombing but these were limited by the amount the planes could carry.
The article Unusual aerial weapons used in World War One mentions pilots in the first few months of the war:
hurtling easily-carried items like bricks, chains, nets, darts and
other projectiles, hoping to strike the propeller, wing, or pilot of
an enemy machine. Even small bombs and grenades were tried. Fighting
in four dimensions left no room for error, which means virtually none
of the thrown objects hit their mark.
The memorial site The Belgians Remembered Them, in a piece titled Lt Charles George Gordon Bayly RFC: aboard the first British aeroplane to be shot down says that "tales abound of...vigorous shaking of the fist, lobbing of bricks and then small arms fire" but clarifies that Bayly, on this fatal reconnaissance flight, only had binoculars.
The article The War in the Air - Fighters: Early Experimentation says:
In the first weeks of the war the pilots and observers went up
unarmed, and often would wave to one another if their paths crossed.
But fairly quickly they began experimenting with means of attacking
one another. Pistols and rifles proved to be ineffective, as did some
of the more bizarre attempts such as throwing bricks, and trailing
bombs or grappling irons behind the plane.
Grappling hooks, along with "other objects", can be sourced as this is mentioned in the Wiki article Aviation in World War I. The source given for this is Great Battles of World War I (1989) by military historian Anthony Livesey (Wiki gives the author as Major-General Sir Jeremy Moore, but he wrote the introduction). Unfortunately, this is not available on Google books for further checking for the original source.
The San Diego Air & Space Museum site also mentions grappling hooks and bricks:
To begin with, pilots on opposing sides were fairly civilized towards
one another, even exchanging friendly smiles and waves, although
obscene gestures and armed combat were quick to follow. Early
air-to-air weapons were crude, sometimes consisting of bricks,
grappling hooks, and even the airplane itself,...
The executive director of this museum is one Bill Lawrence, who may well be the same Bill Lawrence as the author of Fascinating Facts from American History. This book mentions the use of "half bricks" for throwing and then dropping a sack of bricks while flying over an enemy plane, aiming for the propeller. The author says that:
Records show that two German planes were downed this way, but the practice was soon abandoned because the results were not worth the effort.
Unfortunately, the page which has the source for this can't be viewed.
These diverse, ineffective weapons were soon replaced by pistols (also ineffective), then rifles and then machine guns. The latter started being mounted on planes from spring 1915 onward, with the Germans someway ahead of the allies by around the middle of the year.
A cinematic curiosity...
Curiously, the earliest mention I've found for bricks being thrown by pilots is the 1943 Walt Disney partly animated propaganda film Victory Through Air Power. This was based on aviator Alexander P. de Seversky's book of the same name, but includes an initial segment on the history of aviation which is not in the book.
The Walt Disney history department was not at the forefront of historical reliability (e.g. it shows the Germans smashing through the Maginot Line in WWII) so I've included the screenshots below simply as an item of cinematic curiosity.
Disney's crudely stereotyped fictional characters Fritz and Pierre in early WWI action. Source: Victory Through Air Power 1943 Colour (Public Domain)
World War II "brick bomber"
Wrong war, but...according to the site Spitfire Emporium, Art Adams of the 436 Burma Squadron was on a Dakota transporting bricks in April 1945.
A C-47 (KN210) piloted by Denison was transporting the bricks and
couldn't gain altitude, due to being overloaded. Just as this became
apparent, L.A.C. Art Adams spotted a Japanese seaplane beached on a
small island. Someone shouted, "Let's get rid of some bricks!" The
paradrop bell and lights came on, the signal to "Do the drop". During
a few low passes, Adams pushed out as many bricks as he could. No sign
of life was seen around the enemy aircraft and it is doubtful that any
damage was done but, it was certainly the only bombing raid in World
War 2 done with bricks.
The site Vintage Wings of Canada also has this story (along with a painting of the incident) and claims that the Japanese plane was hit.